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 |
谁能告诉我为什么?#include <stdio.h> #include <string.h> int main() { char Haab[19][8]={ "pop", "no", "zip", "zotz", "tzec", "xul", "yoxkin", "mol", "chen", "yax", "zac", "ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu", "uayet" }; char Tzolkin[20][10]={ "imix", "ik", "akbal", "kan", "chicchan", "cimi","manik", "lamat", "muluk", "ok", "chuen", "eb","ben", "ix", "mem", "cib", "caban", "eznab", "canac", "ahau" }; int n, year, day; int i, sum; char month[25]; scanf("%d",&n);//只有这个地方不同 { printf("%d\n",n); while(n--) { scanf("%d. %s %d",&day,month,&year); i = 0; while(strcmp(Haab[i],month) != 0) { i++; } sum = year*365 + day + i*20; printf("%d %s %d\n", sum%13+1, Tzolkin[sum%20], sum/260); } } return 0; } 这个代码能AC #include <stdio.h> #include <string.h> int main() { char Haab[19][8]={ "pop", "no", "zip", "zotz", "tzec", "xul", "yoxkin", "mol", "chen", "yax", "zac", "ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu", "uayet" }; char Tzolkin[20][10]={ "imix", "ik", "akbal", "kan", "chicchan", "cimi","manik", "lamat", "muluk", "ok", "chuen", "eb","ben", "ix", "mem", "cib", "caban", "eznab", "canac", "ahau" }; int n, year, day; int i, sum; char month[25]; while(scanf("%d",&n)!=EOF)//只有这个地方不同 { printf("%d\n",n); while(n--) { scanf("%d. %s %d",&day,month,&year); i = 0; while(strcmp(Haab[i],month) != 0) { i++; } sum = year*365 + day + i*20; printf("%d %s %d\n", sum%13+1, Tzolkin[sum%20], sum/260); } } return 0; } 这个代码就runtime error Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator