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

Re:帮忙看看哪里错了

Posted by vk at 2005-03-23 21:35:34 on Problem 1008
In Reply To:Re:帮忙看看哪里错了 Posted by:19850910 at 2005-03-04 22:55:12
这儿干吗要定义 y为数组阿
> 	int d[20],m[20],y[20],amount,d1,m1,y1;
然后循环:
> 	for(int j=0;j<t;j++)
> 	{
> 		
> 		for(int i=0;i<19;i++)
> 		{
> 			m[j]=i+1;
> 			if(!(strcmp(month[j],mon1[i]))) break;		
> 		}

这儿y[j]就可能溢出阿,不用数组也可以吧
> 		amount=y[j]*365+(m[j]-1)*20+d[j]+1;
> 				y1=(amount-1)/260;
> 		m1=(amount%260)%20;
> 		d1=(amount%260)%13;
> 		if(m1==0) m1=20;
> 		if(d1==0) d1=13;
> 		cout<<d1<<" "<<mon2[m1-1]<<" "<<y1<<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