ACdream 1020The Game about KILL
来源:互联网 发布:网络故障诊断分析 编辑:程序博客网 时间:2024/06/08 01:33
http://acdream.info/problem?pid=1020
n个人围成一个圈报数,报到偶数的人退出,求最后一个人在一开始的位置。
看到数据能到100000000的级别,肯定是有规律的,可以将前100的情况通过暴力打表出来就能看到规律了。
#include<bits/stdc++.h>using namespace std;int main(){ long long int er[11111]; er[0]=1; er[1]=2; for(int i=2;i<=30;i++) er[i]=er[i-1]*2; long long int n; while(cin>>n) { int i; if(n==1) { cout<<"1"<<endl; continue; } for(i=0;i<=30;i++) { if(n>er[i]) n-=er[i]; } long long int ans=(n+n-1); cout<<ans<<endl; //cout<<er[30]<<endl; }return 0;}
阅读全文
0 0
- ACdream 1020 The Game about KILL
- ACdream OJ 1020 The Game about KILL
- ACdream 1020The Game about KILL
- ACdream 1020The Game about KILL
- ACdream 1020 The Game about KILL 典型的约瑟夫环
- ACdream 1020 The Game about KILL【约瑟夫环】
- ACdream 1020 The Game about KILL【约瑟夫环+打表规律】
- ACdreamer 1020 The Game about Kill
- ACdream1020:The Game about KILL
- 约瑟夫环问题 The Game about KILL
- ACdream P1072 Kill the monster
- ACdream Kill The Monster(线性dp)
- acdream 1072 Kill The Monster (dp)
- ACdream 1072 Kill The Monster (dp)
- acd The Game about KILL(和约瑟夫归则一样,归律)
- acdream1020The Game about KILL结题报告[约瑟夫问题]
- about to search or kill the process and the port in the linux
- acdream 1726 A Math game
- 第14周项目1- 验证算法
- PAT编程基础 5-18 二分法求多项式单根 (20分)
- 算法class1
- 中缀表达式转 后缀表达式和前缀表达式
- 初识 Vector List
- ACdream 1020The Game about KILL
- 云+课堂
- python基础9:强化练习
- mat 和 list 转换
- 定义和声明的区别
- Codeforces#449 div 2 题解
- ubuntu下为anaconda安装opencv
- Linux常用命令二
- POJ:1328-Radar Installation