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 |
错在哪里啊?哪位救我一命……#include<iostream.h> #include<string.h> struct Haab { int day,month,year; }; struct Tzolkin { int day,month,year; }; void main() { int t,i,j,*Sum; char point,monHaab[10]; char monthHaab[20][10]={"pop","no","zip","zotz","tzec","xul","yoxkin","mol","chen","yax","zac","ceh","mac","kankin","muan","pax","koyab","cumhu","uayet"}; char monthTzolkin[20][10]={"imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk","ok","chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"}; Haab *pHaab; Tzolkin *pTzolkin; cin>>t; Sum=new int[t]; pHaab=new Haab[t]; pTzolkin=new Tzolkin[t]; for(i=0;i<t;i++) { cin>>pHaab[i].day; pHaab[i].day+=1; cin>>point; cin>>monHaab; for(j=0;j<19;j++) { if(!strcmp(monHaab,monthHaab[j])) { pHaab[i].month =j; break; } } cin>>pHaab[i].year; Sum[i]=pHaab[i].day+20*pHaab[i].month+365*pHaab[i].year; } cout<<t<<endl; for(i=0;i<t;i++) { pTzolkin[i].year =Sum[i]/260; pTzolkin[i].month =Sum[i]%20; if(pTzolkin[i].month==0) pTzolkin[i].month=20; pTzolkin[i].day =Sum[i]%13; if(pTzolkin[i].day ==0) pTzolkin[i].day =13; cout<<pTzolkin[i].day <<" "<<monthTzolkin[pTzolkin[i].month-1]<<" "<<pTzolkin[i].year <<endl; } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator