hdu 6182

给出 $n$

求 $\sum_{i = 1} ^ {\infty} (i * i <= n)$

暴力枚举

hdu 6186

给出 $n$ 个数

$1e6$ 次询问,每次询问这 $n$ 个数不包含第 $p$ 个时的 $xor, or and$ 的值

前缀 + 后缀处理

hdu 6188

给出 $n$ 个数$A_i$

$a.$ 每两个相同的数对答案的贡献为 $1$

$b.$ 每相连的 $3$ 个数对答案的贡献为 $1$

每个数只能使用一次

最大化答案

贪心:取 $i,i - 1, i - 2$ 这个顺子的时候先把 $i - 1,i - 2$ 的对子取掉,取完再取 $i$ 的对子

Code

6182

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath> using namespace std; long long Ksm(long long a, long long b) {
long long ret = ;
while(b) {
if(b & ) ret = ret * a;
a = a * a;
b >>= ;
}
return ret;
} #define LL long long LL num[]; int main() {
for(LL i = ; i <= ; i ++) num[i] = Ksm(i, i);
LL a;
while(cin >> a) {
if(a == ) {
cout << << "\n";
continue;
}
int i;
for(i = ; i <= ; i ++) {
if(num[i] > a) break;
}
cout << i - << "\n";
} return ;
}

6186

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath> using namespace std; #define LL long long const int N = 1e5 + ;
int A[N];
int And[N], Or[N], Xor[N];
int And2[N], Or2[N], Xor2[N];
int n, m; #define gc getchar() inline int read() {
int x = ; char c = gc;
while(c < '' || c > '') c = gc;
while(c >= '' && c <= '') x = x * + c - '', c = gc;
return x;
} int main() {
while(scanf("%d%d", &n, &m) == ) {
And[] = And2[n + ] = ~ ;
Xor[] = Xor2[n + ] = ;
Or[] = Or2[n + ] = ;
for(int i = ; i <= n; i ++) A[i] = read(); //cin >> A[i];
for(int i = ; i <= n; i ++) And[i] = (And[i - ] & A[i]);
for(int i = ; i <= n; i ++) Or[i] = (Or[i - ] | A[i]);
for(int i = ; i <= n; i ++) Xor[i] = (Xor[i - ] ^ A[i]);
for(int i = n; i >= ; i --) And2[i] = (And2[i + ] & A[i]);
for(int i = n; i >= ; i --) Or2[i] = (Or2[i + ] | A[i]);
for(int i = n; i >= ; i --) Xor2[i] = (Xor2[i + ] ^ A[i]);
for(; m; m --) {
int p = read();
printf("%d ", (And[p - ] & And2[p + ]));
printf("%d ", (Or[p - ] | Or2[p + ]));
printf("%d\n", (Xor[p - ] ^ Xor2[p + ]));
}
} return ;
}

6188

#include <iostream>
#include <cstdio>
#include <cstring> const int N = 1e6 + ; #define gc getchar()
inline int read() {
int x = ; char c = gc;
while(c < '' || c > '') c = gc;
while(c >= '' && c <= '') x = x * + c - '', c = gc;
return x;
} int n;
int T[N]; int main() {
while(~ scanf("%d", &n)) {
memset(T, , sizeof T);
int Answer = ;
for(int i = ; i <= n; i ++) T[read()] ++;
for(int i = ; i <= (int)1e6; i ++) {
if(i >= && T[i] && T[i - ] && T[i - ]) {
Answer ++;
T[i] --, T[i - ] --, T[i - ] --;
}
Answer += (T[i] >> );
T[i] %= ;
}
printf("%d\n", Answer);
} return ;
}

hdu 3 * problem的更多相关文章

  1. HDU 6343.Problem L. Graph Theory Homework-数学 (2018 Multi-University Training Contest 4 1012)

    6343.Problem L. Graph Theory Homework 官方题解: 一篇写的很好的博客: HDU 6343 - Problem L. Graph Theory Homework - ...

  2. hdu String Problem(最小表示法入门题)

    hdu 3374 String Problem 最小表示法 view code#include <iostream> #include <cstdio> #include &l ...

  3. HDU 6343 - Problem L. Graph Theory Homework - [(伪装成图论题的)简单数学题]

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6343 Time Limit: 2000/1000 MS (Java/Others) Memory Li ...

  4. HDU 5687 Problem C 【字典树删除】

    传..传送:http://acm.hdu.edu.cn/showproblem.php?pid=5687 Problem C Time Limit: 2000/1000 MS (Java/Others ...

  5. HDU 6342.Problem K. Expression in Memories-模拟-巴科斯范式填充 (2018 Multi-University Training Contest 4 1011)

    6342.Problem K. Expression in Memories 这个题就是把?变成其他的使得多项式成立并且没有前导零 官方题解: 没意思,好想咸鱼,直接贴一篇别人的博客,写的很好,比我的 ...

  6. HDU 6336.Problem E. Matrix from Arrays-子矩阵求和+规律+二维前缀和 (2018 Multi-University Training Contest 4 1005)

    6336.Problem E. Matrix from Arrays 不想解释了,直接官方题解: 队友写了博客,我是水的他的代码 ------>HDU 6336 子矩阵求和 至于为什么是4倍的, ...

  7. HDU 5687 Problem C(Trie+坑)

    Problem C Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) Tota ...

  8. HDU 6430 Problem E. TeaTree(虚树)

    Problem E. TeaTree Problem Description Recently, TeaTree acquire new knoledge gcd (Greatest Common D ...

  9. HDU 4910 Problem about GCD 找规律+大素数判断+分解因子

    Problem about GCD Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others ...

  10. HDU 5688 Problem D map

    Problem D Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total S ...

随机推荐

  1. Android--文件存取

    import java.io.ByteArrayOutputStream; import java.io.FileInputStream; import java.io.FileNotFoundExc ...

  2. Angular 学习笔记 ( 我追的 feature 和 bug )

    Angular 有许多功能还不齐全,也有不少 bug 让人很头疼,所以这里做一些记入 Angular Bug 1.input type="number", valueChanges ...

  3. 使用Feign通过服务名调用服务,找不到服务

    fegineureka 报错环境: eureka注册中心在远程服务器上 本地服务注册到远程的eureka注册中心 本地服务通过Fegin组件+服务名调用服务 报错时,注册中心的情况: Applicat ...

  4. R_数据操作_高级_04

    数学函数: abs(x) 绝对值     sqrt(x) 平方根   ceiling(x) 放回不小于x的最小整数 floor(x) 不小于x的最大整数   trunc(x) 先0方向截取x的整数部分 ...

  5. SMARTY的知识

    smarty的原理: <?php class Smarty { $ldelimiter = "{";//左分隔符 $rdelimiter = "}";// ...

  6. iOS中JSON解析三方库的比较

    网络数据解析框架 1.  JsonModel 一个 JSON 模型转换库,有着比较简洁的接口.Model 需要继承自 JSONModel. 2.  yyModel yyModel比较轻量(算上.h 只 ...

  7. S3C2440 gpio

    WATCHDOG TIMER 原理图 手册 举例 start.S .globl _start _start: /* 关看门狗 */ /* 往WTCON(0x53000000)写0 */ ldr r0, ...

  8. 1.JUC锁的一些概念

    原文链接:http://blog.csdn.net/zteny/article/details/54859228 接下来的几篇文章都转自这里,冒犯之处,多多包涵 原子性: 在看原子性之前,我们先看看什 ...

  9. linux-修改树莓派分辨率

    直接在树莓派下编辑 使用命令行来编辑配置文件 sudo nano /boot/config.txt 并在config.txt文件的最后加上以下代码即可 max_usb_current=1 hdmi_g ...

  10. Vue框架之初识

    介绍 vue.js 是用来构建web应用接口的一个库 技术上,Vue.js 重点集中在MVVM模式的ViewModel层,它连接视图和数据绑定模型通过两种方式.实际的DOM操作和输出格式被抽象的方式到 ...