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 |
Re:留念一下,不知道错哪里了?In Reply To:留念一下 Posted by:Godwind at 2009-09-10 15:38:40 #include<iostream> #include<string> using namespace std; struct Haab { int day; char * month; int year; }; struct Tzolkin { int day; char * month; int year; }; int main () { char* Hb[19]={ "pop","no","zip","zotz","tzec","xul","yoxkin","mol","chen", "yax","zac","ceh","mac","kankin","muan","pax","koyab","cumhu","uayet"}; char* Tn[20]={"imix","ik","akbal","kan","chicchan","cimi","manik","lamat", "muluk","ok","chuen","eb","ben","ix","mem", "cib","caban","eznab","canac","ahau"}; int n,m,tem; cin >> n; Tzolkin* b=new Tzolkin[n]; for ( int i =0;i<n;i++) { int D,Y,sumD; char X; char * mon=new char[10]; cin >> D; while( cin >> X ) if( X =='.') { cin >> mon; break; } cin >> Y; for (int j=0;j<19;j++) { tem = strcmp(mon,Hb[j]); if( tem == 0 ) m=j ; } sumD = Y*365 + 20*(m) +D+1; cout << sumD <<endl; b[i].year = sumD/260 ; int temp= sumD%260%20 ; if( temp ==0 ) temp=20; b[i].month = new char[10]; strcpy(b[i].month ,Tn[temp-1]); if(sumD%260%13==0) b[i].day=13; b[i].day = sumD%260%13; delete []mon; } cout << i << endl; for( i=0;i<n;i++) cout << b[i].day <<" "<< b[i].month <<" "<< b[i].year <<endl; return 1; delete []b; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator