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. Python之推导式笔记

    观察下面的代码: list1 = [] for i in range(10): list1.append(i) print(list1) 作为一个Java出身的程序员,我一定会这么写代码去生成一个列表 ...

  2. 【并发】7、借助redis 实现多线程生产消费队列

    1.这是第一个简单的初始化版本,看起来比使用fqueue似乎更好用 package queue.redisQueue; import queue.fqueue.vo.TempVo; import re ...

  3. Codeforces Round #563 Div. 2

    A:显然排序即可. #include<bits/stdc++.h> using namespace std; #define ll long long #define inf 100000 ...

  4. ASP.net Web API综合示例

    目录 概述 功能介绍 程序结构 服务器端介绍 客户端介绍 “契约” Web API设计规则 并行写入冲突与时间戳 身份验证详解 Web API验证规则 客户端MVVM简介 Web.Config 本DE ...

  5. 天梯赛 L2-024. 部落

    题解:并查集,这里要用路径压缩来优化 代码:// 这里范围理错了, 浪费20分钟debug #include <set> #include <iostream> #includ ...

  6. zabbix 数据库分表操作

    近期zabbix数据库占用的io高,在页面查看图形很慢,而且数据表已经很大,将采用把数据库的数据目录移到新的磁盘,将几个大表进行分表操作 一.数据迁移: 1.数据同步到新的磁盘上,先停止mysql(不 ...

  7. WPF GridView动态添加项并读取数据

    假设数据库有如下表, 首先我们创建一个WPF工程,界面如下 <Window x:Class="WpfApplication2.MainWindow" xmlns=" ...

  8. 同步IO,异步IO,阻塞,非阻塞的定义与区别

    异步I/O 是指用户程序发起IO请求后,不等待数据,同时操作系统内核负责I/O操作把数据从内核拷贝到用户程序的缓冲区后通知应用程序.数据拷贝是由操作系统内核完成,用户程序从一开始就没有等待数据,发起请 ...

  9. Python Web 程序使用 uWSGI 部署

    Python Web 程序使用 uWSGI 部署 WSGI是什么? WSGI,全称 Web Server Gateway Interface,或者 Python Web Server Gateway ...

  10. 简单记录一次注入到shell

    0x00 前言 帮朋友之前拿的一个站,有点久了没有完整截图,简单记录一下. 0x01 基础信息 操作系统:win 集成环境:phpstudy 端口开放:82,3306,3389 有phpmyadmin ...