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 890913 at 2008-08-10 00:52:15 on Problem 1008
#include<iostream>
#include<string>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int i=0;
	int day1=0,year1=0;
	char a[10];
	char ch;
	char flag1[20][10]={"pop","no","zip","zotz","tzec","xul","yoxkin","mol","chen","yax",
						"zac","ceh","mac","kankin","muan","pax","koyab","cumhu","uayet"};
	char flag2[20][10]={"imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk",
						"ok","chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"};
	int month;
	int num[20],year2[20]={0};
	int str[20];
	for(i=0;i<n;i++)
	{
		cin>>day1>>ch>>a>>year1;
		for(int j=0;j<20;j++)
		{	if(strcmp(flag1[j],a)==0)
			{
				month=j;
				break;
			}
		}
		str[i]=(day1+year1*5)%20;
		long sum=105*year1+month*20+day1;
		num[i]=(year1+month*20+day1)%13+1;
		year2[i]=year1+sum/260;
	}
	cout<<n<<endl;
	for(i=0;i<n;i++)
		cout<<num[i]<<" "<<flag2[ str[i] ]<<" "<<year2[i]<<endl;
	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