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<string> using namespace std; int main() { string strHaab[19]={"pop", "no", "zip", "zotz","tzec", "xul", "yoxkin", "mol", "chen", "yax","zac", "ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu","uayet"}; string strholly[20]={"imix", "ik", "akbal", "kan", "chicchan", "cimi", "manik", "lamat", "muluk", "ok", "chuen","eb","ben", "ix", "mem", "cib", "caban", "eznab", "canac", "ahau"}; int n,yearh,dayh,total,yeart,dayt,indexmt; char monthh[6]; while(cin>>n) { cout<<n<<endl; while(n-->0) { scanf("%d.%s%d",&dayh,monthh,&yearh); //printf("%d %s %d\n",dayh,monthh,yearh); int imonthh=19; for(int i=0;i<19;i++) { if(monthh==strHaab[i]) { imonthh=i;break;} } if(imonthh==19) continue; total=yearh*365+imonthh*20+dayh+1; //cout<<total<<endl; dayt=(total-1)%260+1; //当前一年剩余天数 indexmt=(dayt-1)%20; //Tzolkin单词索引+1,-1抵消 dayt=(dayt-1)%13+1; yeart=total%260==0?(total/260-1):total/260; //年数是否为260的倍数 cout<<dayt<<' '<<strholly[indexmt]<<" "<<yeart<<endl; } } //system("pause"); return 0; } //19. mac 0 Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator