2017多校-7
来源:互联网 发布:网络有什么好项目投资 编辑:程序博客网 时间:2024/05/16 06:28
Euler theorem
http://acm.hdu.edu.cn/showproblem.php?pid=6124
比赛时我用计算器算了前几个找到了规律,22334455…….
#include <iostream>#include <cstdio>using namespace std;int main(){ int t; scanf("%d",&t); while(t--) { int a; scanf("%d",&a); int s; if(a%2==1) { s=(a+1)/2+1; } else { s=a/2+1; } printf("%d\n",s); } return 0;}
看了别人的题解,其实一个式子就可以了s=(a-1)/2+2
Kolakoski
http://acm.hdu.edu.cn/showproblem.php?pid=6130
时间给的比较多,打表就可以了
#include <iostream>#include <cstdio>#define LL long longusing namespace std;const int maxn=1e7+10;int a[maxn];int main(){ a[1]=1;a[2]=a[3]=2; int k=4,num=1; for(int i=3;k<=maxn;i++) { for(int j=1;j<=a[i];j++) { a[k]=num; k++; } num=(num==1)?2:1; } int t,n; scanf("%d",&t); while(t--) { scanf("%d",&n); printf("%d\n",a[n]); } return 0;}
阅读全文
0 0
- 2017多校7-三道水题
- 2017多校-7
- 2017HDU多校7场
- 2017 多校7 1011 Kolakoski
- 2017 多校7 1005 Euler theorem
- 2017 多校7场 hdu6129 蜜汁规律
- [题解]2017 多校7 — Just do it
- 2017 多校 水题
- 2017多校-1
- 2017多校 Balala Power!
- 2017 多校 TrickGCD
- 2017多校-2
- 2017多校-3
- 2017多校-4
- 2017多校-5
- 2017多校-6
- 2017多校-8
- 2017多校-9
- MySQL自定义函数用法详解-复合结构自定义变量/流程控制
- java通过反射获取对象的变量和变量值
- ng-zorro-antd初体验
- 微信小程序之发送输入法默认emoji
- elasticsearch查询去重
- 2017多校-7
- tensorflow之深入MNIST专家
- 相关性分析
- ubuntu 的基本使用技巧
- 守护线程和非守护线程
- html之单选按钮
- PLSql连接oracle64位
- 检查约束
- arm linux内核启动过程详解