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 |
为什么gcc就RTE,c就AC?我自己在本地用gcc试了1到13的数据也正常啊,求教!#include <stdio.h> #define MAXK 20 int stored[MAXK]; int main() { int ans, k, t, i, j, j1; for (i=1; i<MAXK; i++) stored[i] = 0; scanf("%d", &k); while (k != 0) { if (stored[k] != 0) printf("%d\n", stored[k]); else { ans = 2; while (1) { t = 2 * k; j = (ans - 1) % t; for (i=0; i<k; i++) { if (j < k) break; j1 = (j + (ans - 1) % (t - 1) + 1) % t; if (j1 > j) j = j1 - 1; else j = j1; t --; } if (i == k) { stored[k] = ans; printf("%d\n", ans); break; } ans ++; } } scanf("%d", &k); } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator