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

第一次WA,第二次AC,谁能告诉我区别在哪?

Posted by songzhenqi at 2010-07-29 15:52:31 on Problem 1658
#include <iostream>
using namespace std;

int main()
{   
	int n,i;
	double a,b,c,d;
	cin>>n;
	for(i=0;i<n;i++)
	{  
		cin>>a>>b>>c>>d;
	    if((b-a)==(c-b))
			cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<d+(b-a)<<endl;
	    if((b/a)==(c/b))
		    cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<(d*d)/c<<endl;
	}
	return 0;
}
-------------------------------------------------------------------------
#include <iostream>
using namespace std;

int main()
{   freopen("in.txt","r",stdin);
	int n,i;
	double a,b,c,d;
	cin>>n;
	for(i=0;i<n;i++)
	{  
		cin>>a>>b>>c>>d;
	    if(a+d==c+b)
			cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<d+(b-a)<<endl;
	    else
		    cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<(d*d)/c<<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