| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
3个句号,3次WA·血的教训···(附代码)#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator