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:I'm going to be crazy!

Posted by mingfang at 2005-10-22 21:34:34 on Problem 1017
In Reply To:I'm going to be crazy! Posted by:mingfang at 2005-10-22 21:31:21
> 这个版面的所有数据都正确,为什么还。。。。
c++,请各位大牛,谁能给出出错的数据:
#include "iostream.h"
int zheng(int a) {return a>=0?a:0;}
int main()
{
	int i,j,d1,d2,m,m1,m3,num[51][7];
	int sample_num,a1=0,a2=0,flag,mod,fmod,k;
	for(i=1;i<=50;i++)
	{
		flag=0;
		for(j=1;j<=6;j++)
		{
			cin>>num[i][j];
			flag+=num[i][j];
		}
		if(!flag) break;
	}
	sample_num=i-1;
	for(i=1;i<=sample_num;i++)
	{
		a1=0;
		d2=zheng(num[i][2]-5*num[i][4]);
			mod=num[i][3]-(num[i][3]/4)*4;
			fmod=(2*(3-mod)+1)+(mod==0?-7:0);			
		m3=(mod==0?0:1)+zheng((int)((float)(d2-fmod)/9+0.98));
		m1=m3+num[i][3]/4+num[i][4];
			for(j=2;j<=4;j++) {a1+=j*j*num[i][j];} 
			a2=11*num[i][5]+m1*36-a1;
			d1=zheng((int)((float)(num[i][1]-a2)/36+0.98));
		m=m1+num[i][6]+num[i][5]+d1;
		cout<<m<<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