URAL 1023 Buttons 博弈
来源:互联网 发布:网络推广怎么收费 编辑:程序博客网 时间:2024/06/07 06:29
当K是L+1的倍数时,先手必败。
又因为L>=2,特殊考虑2*p的数据。
--------
#include <iostream>#include <cmath>using namespace std;int main(){ int K,i,L; while (cin>>K){ for (i=3;i<=(int)sqrt(K);i++){ if (K%i==0) break; } if (K%i==0) L=i-1; else if (K%2==0&&K>4) L=K/2-1; else L=K-1; cout<<L<<endl; } return 0;}
--------
0 0
- URAL 1023 Buttons 博弈
- ural 1023 Buttons
- POJ 2368|URAL 1023|Buttons|博弈论
- Ural 1023. Buttons
- Ural 1023. Buttons
- URAL 1397 Points Game <博弈>
- Buttons
- POJ 2368(Buttons) 巴什博弈变形 Java
- ural 1928 Another ecology problem 博弈dp
- ural 1180. Stone Game (博弈)
- Ural 1045. Funny Game 博弈+dfs
- Ural 1465. Pawn Game nim博弈
- URAL 1639 Chocolate 2 简单博弈
- URAL 1180. Stone Game (博弈 + 规律)
- URAL 2068 Game of Nuts(博弈)
- Ural 1087. The Time to Take Stones 递推+博弈
- ural 1087. The Time to Take Stones(博弈)
- ural 1923 Another Ecology Problem(博弈dp)
- 远程无法访问mysql Can't connect to MySQL server on "host" (111)
- java 正则表达式(转)
- SWERC 2011 / HDU 4196 Remoteland (数论&想法题)
- 2014加油
- iPhone学习第一天,iphoen基本控件的使用
- URAL 1023 Buttons 博弈
- 一步一步学UC(一) - 内存分配
- 异步I/0基础
- Extjs4 图片上传 上传成功后显示图片
- Web开发基础篇---虚拟目录,虚拟主机
- 黑马程序员--十六、7K月薪面试题--银行业务系统
- POJ 2784 Buy or Build 最小生成树
- I/O异步demo
- 算法导引