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. fastjson<1.2.47 RCE 漏洞复现

    这两天爆出了 fastjson 的老洞,复现简单记录一下. 首先使用 spark 搭建一个简易的利用 fastjson 解析 json 的 http server. package cn.hackte ...

  2. go开发 modules 的使用和代理

    go开发 modules 的使用和代理 初学go语言,一堆 来自谷歌的包如 import ( "code.google.com/xxx" ) 不翻墙是很难下载下来的. 另外还有麻烦 ...

  3. C#操作Windows控制面板

    先介绍一下Windows控制面板的一些操作,再介绍如何用C#语言来操作控制面板. 1.如何快速打开控制面板中的项目: 运行输入(大小写不敏感) control system 打开系统信息 contro ...

  4. Hadoop HA 搭建

    Hadoop HA 什么是 HA HA是High Available缩写,是双机集群系统简称,指高可用性集群,是保证业务连续性的有效解决方案,一般有两个或两个以上的节点,且分为活动节点及备用节点.通常 ...

  5. win10如何安装mariadb

    一.下载.安装 1.下载mariadb(https://downloads.mariadb.org/),解压 2.进入bin目录下执行(管理员模型-powershell) .\mysqld.exe - ...

  6. html+css+javascript网页制作技巧总结1

    (一)div.元素居中中显示方法: 1.宽度要有实际值或百分比值 2.margin:0px auto; 文本内容居中显示的方法: 1.text-align:center; 2.line-height: ...

  7. SDcms1.8代码审计

    由于工作原因,分析了很多的cms也都写过文章,不过觉得好像没什么骚操作都是网上的基本操作,所以也就没发表在网站上,都保存在本地.最近突然发现自己博客中实战的东西太少了,决定将以前写的一些文章搬过来,由 ...

  8. iOS 毛玻璃效果的实现方法

    iOS开发中有的时候需要将图片设置模糊,来实现特定的效果获取更好的用户体验, iOS7之后半透明模糊效果得到大范围使用的比较大,现在也可以看到很多应用局部用到了图片模糊效果,可以通过高斯模糊和毛玻璃效 ...

  9. iOS开发 CGAffineTransform 让图片旋转, 旋转后获得图片旋转的角度

    1.让图片旋转 UIImageView *imageView = [[UIImageView alloc]init]; imageView.frame = CGRectMake(50, 50, 200 ...

  10. Eclipse上安装websphere

    Eclipse上安装websphere 参考:https://blog.csdn.net/qq_26264237/article/details/90107508 安装websphere插件 WebS ...