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 <cstdio> #include <iostream> #include <cstring> #define MAXN 400 int day[MAXN]; char haha[19][10]={"pop","no","zip","zotz","tzec","xul","yoxkin","mol","chen","yax", "zac","ceh", "mac","kankin", "muan","pax","koyab","cumhu","uayet"}; char taz[20][10]={"imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk", "ok","chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"}; using namespace std; int fd(char *s) { for ( int i=0; i<19; i++) if (!strcmp(s,haha[i])) return i; return 0; } int main(void) { int n,m,i,d,y,c; char s[10]; scanf("%d",&n); for ( i=0; i<n; i++) { scanf("%d. %s %d",&d,s,&y); m=fd(s); day[i]=y*365+m*20+d+1;//因为每天的编号是从0开始的 } printf("%d\n",n); int ax,ay,az; for ( i=0; i<n; i++) { c=day[i]%260; if (c) ax=(c-1)%13+1,ay=(c-1)%20,az=day[i]/260; else ax=13,ay=19,az=day[i]/260-1; printf("%d %s %d\n",ax,taz[ay],az); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator