Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
16ms与0ms的区别,比你少个if()In Reply To:不超时++ Posted by:orangelegend at 2008-09-24 21:45:13 #include <cstdio> int main() { int n, m, t, r; while(scanf("%d", &n), n != 0) { m = 1; while(1) { r = n - 1; t = (m - 1) % r; while(t > 0) { --r; t = (t + m - 1) % r; } if(r == 1) { printf("%d\n", m); break; } ++m; } } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator