Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

RUNTIME 啦 求解决!~

Posted by sakula at 2008-09-15 23:27:03 on Problem 1008
#include<iostream>
#include<cstring>
#include<cstdlib>
using namespace std;

void convert(void)
{
long int i,NumberOfTheDay,month2,sumdays,temp1,temp2,ab;
int year;
char month1[10];
char c;
const char *Month1[]={"pop","no","zip","zotz","tzec","xul","yoxkin","mol","chen","yax","zac","ceh","mac","kankin","muan","pax","koyab","cumhu","uayet"};
const char *Month2[]={"imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk","ok","chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"};
cin>>NumberOfTheDay>>c>>month1>>year;
temp1=strcmp(month1,Month1[18]);
if(temp1==0)
{
	sumdays=year*365+NumberOfTheDay+361;
    month2=sumdays%20;
       if(sumdays%13==0)
            cout<<13<<" "<<Month2[19-month2]<<" "<<(sumdays-1)/260<<endl;
       else
           cout<<sumdays%13<<" "<<Month2[19-month2]<<" "<<(sumdays-1)/260<<endl;
       goto end;
}

for(i=0;i<18;i++)
{
	temp2=strcmp(month1,Month1[i]);
     if(temp2==0)
	 {ab=i;
     break;}
	 else continue;
}
sumdays=year*365+NumberOfTheDay+i*20+1;
month2=sumdays%20;
if(sumdays%13==0)
     cout<<13<<" "<<Month2[month2-1]<<" "<<sumdays/260<<endl;
else
cout<<sumdays%13<<" "<<Month2[month2-1]<<" "<<sumdays/260<<endl;
end:;
}


int main()
{ 
long int j,N;
void convert(void);
cin>>N;
cout<<N<<endl;
for(j=0;j<N;j++)
convert();
return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator