I Think I Need a HouseboatTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 15001 Accepted Submission(s): 4217 Problem Description
Input The first line of input will be a positive integer indicating how many data sets will be included (N). Output For each data set, a single line of output should appear. This line should take the form of:
Sample Input 2 1.0 1.0 25.0 0.0
Sample Output
Property 1: This property will begin eroding in year 1. Property 2: This property will begin eroding in year 20. END OF OUTPUT.
Source
Recommend PrincetonBoy | We have carefully selected several similar problems for you: 1071 1056 1060 1066 1064 |
题解:变样的卡精度,pi 只能取 3.1415926
wa 代码:
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#define pi acos(-1.0) 错
using namespace std;
double x,y;
int main(){
int t;
scanf("%d",&t);
for(int i=1;i<=t;i++){
scanf("%lf %lf",&x,&y);
double r=sqrt(x*x+y*y);
double s=pi*r*r/2.0;
printf("Property %d: This property will begin eroding in year %d.\n",i,(int)(floor(s/50.0))+1);
}
printf("END OF OUTPUT.\n");
return 0;
}
ac 代码:
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#define pi 3.1415926
using namespace std;
double x,y;
int main(){
int t;
scanf("%d",&t);
for(int i=1;i<=t;i++){
scanf("%lf %lf",&x,&y);
double r=sqrt(x*x+y*y);
double s=pi*r*r/2.0;
printf("Property %d: This property will begin eroding in year %d.\n",i,(int)(floor(s/50.0))+1);
}
printf("END OF OUTPUT.\n");
return 0;
}