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 |
可能和对错无关,只是建议你学习使用数组和循环In Reply To:大家讨论出容易出错的地方我好像都考虑了,,可是还是WA,希望有人可以指点一下先谢谢了, Posted by:deep_you at 2005-02-26 17:38:17 如果有几百几千个月,你是不是也这样写?:) > #include <stdio.h> > #include <string.h> > int strcmp(char n1[10],char n2[10]) > { > int i; > if(strlen(n1)!=strlen(n2))return(0); > for(i=0;n1[i];i++) > if(n1[i]!=n2[i])return(0); > return(1); > } > > void main() > { > int n,i,day,year,mouth,years; > long days; > char m[10]; > scanf("%d",&n); > for(i=0;i<n;i++) > { > scanf("%d. %s %d",&day,m,&year); > if(strcmp(m,"pop")==1)mouth=1; > if(strcmp(m,"no")==1)mouth=2; > if(strcmp(m,"zip")==1)mouth=3; > if(strcmp(m,"zotz")==1)mouth=4; > if(strcmp(m,"tzec")==1)mouth=5; > if(strcmp(m,"xul")==1)mouth=6; > if(strcmp(m,"yoxkin")==1)mouth=7; > if(strcmp(m,"mol")==1)mouth=8; > if(strcmp(m,"chen")==1)mouth=9; > if(strcmp(m,"yax")==1)mouth=10; > if(strcmp(m,"zac")==1)mouth=11; > if(strcmp(m,"ceh")==1)mouth=12; > if(strcmp(m,"mac")==1)mouth=13; > if(strcmp(m,"kankin")==1)mouth=14; > if(strcmp(m,"muan")==1)mouth=15; > if(strcmp(m,"pax")==1)mouth=16; > if(strcmp(m,"koyab")==1)mouth=17; > if(strcmp(m,"cumhu")==1)mouth=18; > if(strcmp(m,"uayet")==1)mouth=19; > days=365*(long)year+(mouth-1)*20+day+1; > if(days%13==0)printf("13 "); > else printf("%d ",days%13); > years=days/260; > days=days%260; > days=days%20; > if(days==1)printf("imix "); > if(days==2)printf("ik "); > if(days==3)printf("akbal "); > if(days==4)printf("kan "); > if(days==5)printf("chicchan "); > if(days==6)printf("cimi "); > if(days==7)printf("manik "); > if(days==8)printf("lamat "); > if(days==9)printf("muluk "); > if(days==10)printf("ok "); > if(days==11)printf("chuen "); > if(days==12)printf("eb "); > if(days==13)printf("ben "); > if(days==14)printf("ix "); > if(days==15)printf("mem "); > if(days==16)printf("cib "); > if(days==17)printf("caban "); > if(days==18)printf("eznab "); > if(days==19)printf("canac "); > if(days==0)printf("ahau "); > printf("%d\n",years); > } > } > > > > > > > > > Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator