PKU 2368 Buttons
http://poj.org/problem?id=2368
ある数字Kが与えられる。
二人のプレイヤーが1からKまでの数字のうち最大L個を順番に言っていく。
Kを言ったほうが勝ちである。
後攻のプレイヤーはL(2<=L
main(){ int k; cin>>k; for(int i=3;i*i<=k;++i){ if(k%i==0){ cout<<i-1<<endl; return 0; } } if(k%2==0 && k/2-1>=2)cout<<k/2-1<<endl; else if(k-1>=2)cout<<k-1<<endl; else cout<<0<<endl; }