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 |
Re:测试数据也过了 但是总是不能通过In Reply To:Re:测试数据也过了 但是总是不能通过 Posted by:fyliang_wh at 2006-03-24 14:34:27 > 你看看我的程序! > char month2[20][10] ={ "imix ", "ik ", "akbal ", "kan ", "chicchan ", "cimi ", "manik ", "lamat ", "muluk ", "ok ", "chuen ","eb ", "ben ", "ix ", "mem ", "cib ", "caban ", "eznab ", "canac ", "ahau "}; > 这儿按初始数据来的, > 后来的天数需要+1 > > #include <string.h> > #include <stdio.h> > #define NUM_DAY1 365 > #define NUM_DAY2 (13 * 20) > int main() > { > char month1[19][9]={"pop", "no","zip","zotz","tzec","xul","yoxkin","mol","chen","yax","zac", "ceh","mac","kankin","muan","pax","koyab","cumhu","uayet"}; > char month2[20][10] ={ "imix ", "ik ", "akbal ", "kan ", "chicchan ", "cimi ", "manik ", "lamat ", "muluk ", "ok ", "chuen ","eb ", "ben ", "ix ", "mem ", "cib ", "caban ", "eznab ", "canac ", "ahau "}; > int year1,day1,year2,day2,day,n,i,cnt,r; > char t,input[30],month[10],*nameOfDay=(char *)malloc(10*sizeof(char)); > scanf("%d",&n); > printf("%d\n",n); > while(n>0){ > scanf("%d",&day1); //// ? > scanf("%c",&t); /////? > scanf("%s",month); ////? > scanf("%d",&year1); //////? 空格呢 > > //change > for (i=0;strcmp(month,month1[i]);i++); > cnt = year1 * NUM_DAY1 + i * 20 + day1; > year2 = cnt / NUM_DAY2; > r = cnt % NUM_DAY2; > day2 = r % 13 + 1; > nameOfDay = month2[r % 20]; > printf("%d %s%d\n",day2,nameOfDay,year2); > n--; > } > return 0; > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator