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 |
哪位大侠帮忙看下哪错了,总是WA!#include "stdio.h" #include "string.h" int main() {int i,n,day,month,Year,number,lchar; long days,year; char a[12],p[12]; scanf("%d",&n); printf("%d\n",n); for(i=0;i<n;i++) {scanf("%d. %s %ld",&day,a,&year); if(strcmp(a,"uayet")==0) month=18; else if(strcmp(a,"cumhu")==0) month=17; else if(strcmp(a,"koyab")==0) month=16; else if(strcmp(a,"pax")==0) month=15; else if(strcmp(a,"muan")==0) month=14; else if(strcmp(a,"kankin")==0) month=13; else if(strcmp(a,"mac")==0) month=12; else if(strcmp(a,"ceh")==0) month=11; else if(strcmp(a,"zac")==0) month=10; else if(strcmp(a,"yax")==0) month=9; else if(strcmp(a,"chen")==0) month=8; else if(strcmp(a,"mol")==0) month=7; else if(strcmp(a,"yoxkin")==0) month=6; else if(strcmp(a,"xul")==0) month=5; else if(strcmp(a,"tzec")==0) month=4; else if(strcmp(a,"zotz")==0) month=3; else if(strcmp(a,"zip")==0) month=2; else if(strcmp(a,"no")==0) month=1; else if(strcmp(a,"pop")==0) month=0; days=year*365+month*20+day+1; Year=days/260; number=days%13; lchar=days%20; switch(lchar) {case 0: strcpy(p,"ahau");break; case 1: strcpy(p,"imix");break; case 2: strcpy(p,"ik");break; case 3: strcpy(p,"akbal");break; case 4: strcpy(p,"kan");break; case 5: strcpy(p,"chiccban");break; case 6: strcpy(p,"cimi");break; case 7: strcpy(p,"manik");break; case 8: strcpy(p,"lamat");break; case 9: strcpy(p,"muluk");break; case 10:strcpy(p,"ok");break; case 11:strcpy(p,"chuen");break; case 12:strcpy(p,"eb");break; case 13:strcpy(p,"ben");break; case 14:strcpy(p,"ix");break; case 15:strcpy(p,"mem");break; case 16:strcpy(p,"cib");break; case 17:strcpy(p,"caban");break; case 18:strcpy(p,"eznab");break; case 19:strcpy(p,"canac");break; } printf("%d %s %d\n",number,p,Year); } return 1; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator