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 |
其实不用那么复杂的,老友,将最后一个月看成0月就好简单喇In Reply To:请教!老是woring answer!是什么问题啊。 Posted by:plumage at 2005-04-17 21:33:20 > #include<iostream.h> > #include<string.h> > #include<fstream.h> > > #define lofhaab 365 > #define loftzol 260 > char Tzolkin[21][10]={"","imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk","ok","chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"}; > char Haab[20][10]={"","pop", "no", "zip", "zotz","tzec", "xul", "yoxkin", "mol", "chen", "yax", "zac", "ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu"}; > void main() > { > fstream fin("in.txt",ios::in||ios::out); > int n; > > fin>>n; > cout<<n<<endl; > unsigned long day,year,days,name; > char month[10]; > char point; > int i,j; > for(i=0;i<n;i++) > { > fin>>day>>point>>month>>year; > for(j=1;j<20;j++) > { > if(strcmp(month,Haab[j])==0) > break; > } > > days=year*lofhaab+(day+1)+((j-1)*20); > > year=days/loftzol;//years in tozolkin > days=days%loftzol; > > if(days==0) > { > days=loftzol; > year--; > } > name=days%20; > day=days%13; > > if(day==0) > { > day=13; > } > if(name==0) > { > name=20; > } > > cout<<day<<" "<<Tzolkin[name]<<" "<<year<<endl; > } > } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator