#include <stdio.h> #include <string.h> #include <time.h> double start,finish; int check(int m, int k) { int remainder = 0; int position = 0; int count = 0; for(count = 2 * k; count != k; count--) { remainder = m % count; position = (remainder + position + 1) % count; if(position <= k) { return 0; } } return 1; } int main(int argc, char *argv[]) { int m = 0; int k = 0; scanf("%d", &k); m = k + 1; while(1) { if(check(m, k)) { break; } m++; } printf("%d", m); return 0; }
相关文章
- 11-16poj2月下旬题解
- 11-16素数筛 poj 2689
- 11-16POJ 1011 Sticks
- 11-16POJ 2752 Seek the Name, Seek the Fame KMP
- 11-16【缩点+拓扑判链】POJ2762 Going from u to v or from v to u?
- 11-16[poj 1127]Jack Straws[线段相交][并查集]
- 11-16poj 1127 -- Jack Straws(计算几何判断两线段相交 + 并查集)
- 11-16poj2656---求一列数中最大数的序数而且在前面输入的更优先
- 11-16POJ1149 PIGS
- 11-16kmp-poj3461 oulipu