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 Error??更好的算法??

Posted by xli at 2005-09-05 20:51:31 on Problem 1008
#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:
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