| ||||||||||
| 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 | |||||||||
为什么是Runtime Error??更好的算法??#include<math.h>
#include<string.h>
#include<iostream.h>
#include<stdio.h>
void main(){
char buff;char month[7],*monthout; int count,n,m,day,year,dayout,yearout,ht;
char *holly[20]={"imix","ik1","akbal","kan","chicchan","cimi","manik","lamat","muluk","ok","chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"};
char *haab[19]={"pop","no","zip","zotz","tzec","xul","yoxkin","mol","chen","yax","zac","ceh","mac","kankin","muan","pax","koyab","cumhu","uayet"};
cin>>count;cout<<count<<endl;
for(int i=0;i<count;i++){
cin>>day;day++;
cin>>buff;
cin>>month;month[6]='\0';
cin>>year;
for(int j=0;j<18;j++)
if(!strcmp(haab[j],month)) break;
n=year/100;m=year%100;
ht=(n*365)%260*100+m*365+day+j*20;
yearout=n*365/260*100+ht/260;
monthout=holly[(ht%260-1)%20];
dayout=(ht%260-1)%13+1;
cout<<dayout<<" "<<monthout<<" "<<yearout<<endl;
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator