标签:
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 2094 Accepted Submission(s): 1273
#include<cstdio> #include<cstring> #include<cmath> #include<iostream> #include<algorithm> using namespace std; int k; int dp[15]; bool solve(int m){ int cur=0; for(int i=1;i<=k;i++){ if((cur+m-1)%(2*k-i+1)<k) return false; cur=(cur+m-1)%(2*k-i+1); } return true; } int main(){ for(k=1;k<15;k++){ int i; for(i=1;;i++){ if(solve(i))break; } dp[k]=i; } while(~scanf("%d",&k),k){ printf("%d\n",dp[k]); } return 0; }
标签:
原文地址:http://www.cnblogs.com/handsomecui/p/5125189.html