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 <iostream> #include <cstring> using namespace std; char *monthNamesH[] = {"pop","no","zip","zotz","tzec","xul","yoxkin","mol","chen","yax","zac","ceh","mac","kankin","muan","pax","koyab","cumhu","uayet"}; char *namesT[] = {"imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk","ok","chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"}; int getIndex(char*src[],int srclen,char*str) { int i; for (i = 0; i < srclen; i++) { if (strcmp(src[i],str) == 0) { return i; } } return -1; } int main() { int caseCnt=0,i=0; int hday=0,hmonth=0,hyear=0; int tperiod=0,tnumber=0,tyear=0; int totalDays=0; char strMonth[10] = {0}; cin>>caseCnt; cout<<caseCnt<<endl; for (i = 0; i < caseCnt; i++) { cin>>hday; cin.ignore(); cin>>strMonth>>hyear; hmonth = getIndex(monthNamesH,19,strMonth); totalDays = hyear*365+hmonth*20+hday; tyear = totalDays/260; tperiod = (totalDays - tyear*260)%20; tnumber = (totalDays - tyear*260+1)%13; cout<<tnumber<<" "<<namesT[tperiod]<<" "<<tyear<<endl; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator