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 |
last day of the year?In Reply To:裸身雪地涕血跪求高手指教,受不了了,为什么会WA呢? Posted by:vk at 2005-03-23 21:44:16 > #include <stdio.h> > #include <string.h> > > int main(){ > long int day; > int i,j,case_num; > int tzyear,tzmonth,tzday; > int hayear,hamonth,haday; > char hamname[7]; > char tzdname[9]; > char hamonths[19][7]={"pop", "no", "zip", "zotz", "tzec", "xul", "yoxkin", "mol", "chen", "yax", "zac", "ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu"}; > char tzdays[20][9]={"imix", "ik", "akbal", "kan", "chicchan", "cimi", "manik", "lamat", "muluk", "ok", "chuen", "eb", "ben", "ix", "mem", "cib", "caban", "eznab", "canac", "ahau"}; > > scanf("%d",&case_num); > printf("%d\n",case_num); > for(i = 0;i<case_num;i++){ > scanf("%d. %s %d",&haday,hamname,&hayear); > for(j = 0;j<19;j++){ > if(strcmp(hamname,hamonths[j]) == 0){ > hamonth = j; > break; > } > } > day = hayear*365 + hamonth*20 + haday; > tzyear = day/260; > day = day - tzyear*260; > tzmonth = day%13; > tzday = day%20; > printf("%d %s %d\n",tzmonth+1,tzdays[tzday],tzyear); > } > return 0; > } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator