A.A Math Problem

 #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
inline ll read(){
int x=,f=;char ch=getchar();
while(ch>''||ch<''){if(ch=='-')f=-;ch=getchar();}
while(ch>=''&&ch<=''){x=x*+ch-'';ch=getchar();}
return x*f;
} /***********************************************************/ const int maxn = 1e5+;
ll a[maxn]; void init(){
for(ll i = ;i <= ;i++){
a[i] = ;
for(ll j = ;j <= i;j++){
a[i] *= i;
}
//cout << i << " :" << a[i] << endl;
}
} int main(){
init();
ll n;
while(~scanf("%lld", &n)){
int ans = ;
for(ll i = ;i <= ;i++){
if(n >= a[i])
ans++;
else break;
}
cout << ans << endl;
}
return ;
}

G.Duizi and Shunzi

 #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
inline ll read(){
int x=,f=;char ch=getchar();
while(ch>''||ch<''){if(ch=='-')f=-;ch=getchar();}
while(ch>=''&&ch<=''){x=x*+ch-'';ch=getchar();}
return x*f;
} /***********************************************************/ const int maxn = 1e6+;
int a[maxn]; int main(){
int n;
while(~scanf("%d", &n)){
memset(a, , sizeof(a));
for(int i = ;i <= n;i++){
int x;
x = read();
a[x]++;
}
int ans = ;
for(int i = ;i <= n;i++){
ans += a[i]/;
a[i] %= ;
if(i+ <= n){
if(a[i] && a[i+]% && a[i+]){
ans++;
a[i]--;a[i+]--;a[i+]--;
}
} }
printf("%d\n", ans);
}
return ;
}

2017ACM/ICPC广西邀请赛的更多相关文章

  1. 2017ACM/ICPC广西邀请赛-重现赛 1007.Duizi and Shunzi

    Problem Description Nike likes playing cards and makes a problem of it. Now give you n integers, ai( ...

  2. 2017ACM/ICPC广西邀请赛-重现赛 1010.Query on A Tree

    Problem Description Monkey A lives on a tree, he always plays on this tree. One day, monkey A learne ...

  3. 2017ACM/ICPC广西邀请赛-重现赛 1004.Covering

    Problem Description Bob's school has a big playground, boys and girls always play games here after s ...

  4. 2017ACM/ICPC广西邀请赛-重现赛

    HDU 6188 Duizi and Shunzi 链接:http://acm.hdu.edu.cn/showproblem.php?pid=6188 思路: 签到题,以前写的. 实现代码: #inc ...

  5. HDU 6191 2017ACM/ICPC广西邀请赛 J Query on A Tree 可持久化01字典树+dfs序

    题意 给一颗\(n\)个节点的带点权的树,以\(1\)为根节点,\(q\)次询问,每次询问给出2个数\(u\),\(x\),求\(u\)的子树中的点上的值与\(x\)异或的值最大为多少 分析 先dfs ...

  6. 2017ACM/ICPC广西邀请赛-重现赛 1001 A Math Problem

    2017-08-31 16:48:00 writer:pprp 这个题比较容易,我用的是快速幂 写了一次就过了 题目如下: A Math Problem Time Limit: 2000/1000 M ...

  7. 2017ACM/ICPC广西邀请赛-重现赛1005 CS course

    2017-08-31 16:19:30 writer:pprp 这道题快要卡死我了,队友已经告诉我思路了,但是做题速度很缓慢,很费力,想必是因为之前 的训练都是面向题解编程的缘故吧,以后不能这样了,另 ...

  8. 2017ACM/ICPC广西邀请赛 Duizi and Shunzi

    题意:就是一个集合分开,有两种区分 对子:两个相同数字,顺子:连续三个不同数字,问最多分多少个 解法:贪心,如果当前数字不构成顺子就取对子 /2,如果可以取顺子,那么先取顺子再取对子 #include ...

  9. 2017ACM/ICPC广西邀请赛 CS Course

    题意:删除指定数字,求剩下数字的与或非值 解法:保存一下前缀和后缀 #include <iostream> #include <stdio.h> #include <ve ...

随机推荐

  1. leetcode 2 Add Two Numbers(链表)

    数字反过来这个没有什么麻烦,就是镜像的去算十进制加法就可以了,然后就是简单的链表. /** * Definition for singly-linked list. * struct ListNode ...

  2. C语言小程序(六)、数组操作

    对数组进行操作,查找.插入.删除. #include <stdio.h> #include <stdlib.h> #include <time.h> int siz ...

  3. 流媒体直播服务器:Bull-Live-Server

    Bull Live Server 简称 BLS ,旨在使用C++语言提供强大功能和高性能的流媒体直播服务器. 为何要写 BLS ? 1.simple rtmp server https://githu ...

  4. 错误名称:Uncaught SyntaxError: Unexpected identifier

    控制台输出: 1.谷歌:Uncaught SyntaxError: Unexpected identifier 2.火狐:SyntaxError: missing ] after element li ...

  5. #include <deque>

    deque \(deque\)头文件主要包括一个双端队列容器.是一个支持在两端插入两端删除的线性储存空间,与vector和queue相似.与\(vector\)比起来,\(deque\)可以在\(O( ...

  6. bzoj 1185 最小矩形覆盖 —— 旋转卡壳

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=1185 枚举一条边,维护上.左.右方的点: 上方点到这条边距离最远,所以用叉积求面积维护: 左 ...

  7. python setuptools安装

    执行# python setup.py install 时发生如下错误 Traceback (most recent call last): File "setup.py", li ...

  8. POJ3630(Trie树)

    Phone List Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 26385   Accepted: 7957 Descr ...

  9. java代码GUI简单的。。。

    总结:觉得 package com.da; import java.awt.*; //逆向思维:important //创建一个String对象的数组,然后执行读取文本,把文本每一行存入数组,它将读取 ...

  10. 完美前向保密PFS

    ===========来自网友=========== “前向安全性”应当是叫做“forward security”.该定义最早是由Mihir Bellare和Sara K. Miner在 CRYPTO ...