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. stl_hashtable.h

    stl_hashtable.h // Filename: stl_hashtable.h // Comment By: 凝霜 // E-mail: mdl2009@vip.qq.com // Blog ...

  2. PS 滤镜——(扭曲)球面化 Spherize

    %%%% Spherize clc; clear all; close all; addpath('E:\PhotoShop Algortihm\Image Processing\PS Algorit ...

  3. 【二叉查找树】05根据升序的链表构造二叉查找树【Convert Sorted List to Binary Search Tree】

    利用递归,构造二叉查找树, ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 给一个 ...

  4. Spring MVC表单提交

    实际应用中,列表中的单条记录的修改,可能需要传很多对象参数到后台服务器,Spring MVC表单标签<form:> 提供了一种简洁的提交方式. <form id="form ...

  5. SQL 常用语句收集

    1.UPDATE 表名称 SET 列名称 = 新值 WHERE 列名称 = 某值 2.SELECT * FROM TableA INNER JOIN TableB ON TableA.name = T ...

  6. 机器学习:scikit-learn中算法的调用、封装并使用自己所写的算法

    一.scikit-learn库中的kNN算法 scikit-learn库中,所有机器学习算法都是以面向对象的形式进行包装的: 所有scikit-learn库中机器学习算法的使用过程:调用.实例化.fi ...

  7. 【转】 Pro Android学习笔记(四七):Dialog(4):一些补充和思考

    目录(?)[-] 编程思想封装接口 fragment和activity以其他fragment之间的通信 编程思想:封装接口 在小例子中,fragment会调用activity的onDialogDone ...

  8. 图解Stm32使用jlink下载程序时jtag接口(SW和JTAG模式)的简化方法

    转自: http://www.it165.net/embed/html/201308/2332.html 用过stm32的人都知道stm32有两种常用下载程序的方法,用串口和jlink.串口下载方法和 ...

  9. angular-cli.json配置参数解析,常用命令解析

    1.angular-cli.json配置参数解析 { "project": { "name": "ng-admin", //项目名称 &qu ...

  10. Linux性能测试工具-UnixBench--安装以及结果分析

    参考链接:http://blog.csdn.net/gatieme/article/details/50912910 依赖包安装:      yum install -y SDL-devel mesa ...