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 |
为什么我总是runtim error啊 why does my program always return "runtime error"#include<stdio.h> #include<string.h> #define MAX_SIZE 10 int main() { char Haab_month[19][7]={ "pop", "no", "zip", "zotz", "tzec", "xul", "yoxkin", "mol", "chen", "yax", "zac", "ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu", "uayet"}; char Tzolkin_dayword[20][9]={ "imix", "ik", "akbal", "kan", "chicchan", "cimi", "manik", "lamat", "muluk", "ok", "chuen", "eb", "ben", "ix", "mem", "cib", "caban", "eznab", "canac", "ahau"}; int day; char hm[7]; int year; int i=0,j=0,n; int result_period[MAX_SIZE]; /*1~13*/ char result_day[MAX_SIZE][9]; /* imix~ahau*/ int result_year[MAX_SIZE]; int temp_day; scanf("%d",&n); while( j<n){ if(scanf("%d. %s %d",&day,hm,&year)==EOF) break; for(i=0;i<18;i++) if(!strcmp(hm,Haab_month[i]) ){ temp_day=i*20+day ; break; } if( !strcmp(hm,Haab_month[18]) ) temp_day=360+day ; result_year[j]= (year * 365 + temp_day)/260; day=(year*365 + temp_day )% 260+1; result_period[j]=day%13?day%13:13; /* 4. uayet 259 正解是 13 ahau 364 而不是13 ahau 365 */ strcpy(result_day[j],Tzolkin_dayword[(day%20?day%20:20)-1] ); j++; } printf("%d\n",n); for(i=0;i<n;i++) printf("%d %s %d\n",result_period[i],result_day[i],result_year[i]); return 1; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator