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. C/C++中内存泄漏、内存溢出与野指针的解释与说明

    1.内存泄漏 内存泄漏是指我们在堆中申请(new/malloc)了一块内存,但是没有去手动的释放(delete/free)内存,导致指针已经消失,而指针指向的东西还在,已经不能控制这块内存, 所以就是 ...

  2. 将图片画到canvas 上的几种方法(转)

    转自:https://blog.csdn.net/qq_15009739/article/details/82809525

  3. Linux下OpenSSL加密解密压缩文件(AES加密压缩文件)

    OpenSSL是一个开源的用以实现SSL协议的产品,它主要包括了三个部分:密码算法库.应用程序.SSL协议库.Openssl实现了SSL协议所需要的大多数算法.下面介绍使用Openssl进行文件的对称 ...

  4. pymysql操作mysql数据库

    1.建库 import pymysql # 建库 try: conn=pymysql.connect( host='127.0.0.1', port=3306, user='root', passwd ...

  5. 1+x证书学习日志——css 基本选择符

    ##css选择符                 1:类型选择符 直接用标签名称当作选择符                     特点:选中所有同类元素                 2:id名称 ...

  6. JS如何做爬虫

    JS如何做爬虫,JS做爬虫要靠node节点环境,cheerio(主要是解析下载的网页可以像jquery一样,这是必要的,使用它在npm上查看文档也很简单). Iconv-lite(主要解决下载资源的乱 ...

  7. Linux中关于dns配置的小记

    一. 如上图 我当时的网卡配置文件里是静态模式,然后DNS1=114.114.114.114. 就是纳闷,这是为什么 随后,我又是将网卡配置文件,修改为DNS1=114.114.114.113. 重启 ...

  8. Android笔记(二十五) ListView的缓存机制与BaseAdapter

    之前接触了ListView和Adapter,Adapter将数据源和View连接起来,实际应用中,我们要显示的数据往往有很多,而屏幕只有那么大,系统只能屏幕所能显示的内容,当我们滑动屏幕,会将旧的内容 ...

  9. 一个s的力量——http与https

    我们网络上有很多资源,那么我们怎么来访问呢?就拿一个小例子来说,我们都会用百度来搜索东西,就会在地址栏中输入这样的地址http://www.baidu.com这种访问方式就是通过URL来实现的,那么什 ...

  10. 混合应用 微信登录授权 微信登录认证失败 ios PGWXAPI错误-1 code:-100 / 安卓 message:invalid appsecret innerCode:40125

    最近项目需要做微信登录,于是利用HTML5+ API Reference的OAuth模块管理客户端的用户登录授权验证功能,允许应用访问第三方平台的资源.(链接:https://www.dcloud.i ...