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

3个句号,3次WA·血的教训···(附代码)

Posted by songzhenqi at 2010-10-03 16:52:27 on Problem 1005
#include <iostream>
using namespace std;

int distance(double x,double y)
{
	return(x*x+y*y);
}

int judge(double x,double y)
{
	int year=1;
	bool flag=true;
    while(flag)
	{
		if(distance(x,y)*3.1415926<100*year)
		{
			flag=false;
			return year;
		}
		else
			year++;
	}

}

int main()
{   freopen("in.txt","r",stdin);
	int distance(double,double);
	int judge(double,double);
	int N,i=1;
	double X,Y;
	cin>>N;
	while(i<=N)
	{
		cin>>X>>Y;
		cout<<"Property "<<i<<": This property will begin eroding in year "<<judge(X,Y)<<"."<<endl;
		i++;
	}
	cout<<"END OF OUTPUT."<<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