hdu1065

参考:

http://acm.hdu.edu.cn/discuss/problem/post/reply.php?postid=12633&messageid=1&deep=0

http://acm.hdu.edu.cn/discuss/problem/post/reply.php?postid=24925&messageid=1&deep=0

话说这种题存在的意义是为了证明运气这回事吗?(做这道题的我存在的意义是证明有的人运气真的不好吗?)除了PI取的位数以外,其他没什么问题。

#include<stdio.h>
#include<string.h>
#include<math.h>
#include<iostream>
using namespace std;
#define PI 3.141592//关键是这里,必须是3.1415926,位数多了,少了都不行

int main(){
    int t;
    double tempx,tempy;
    double r,area;
    long long int ans;

    scanf("%d",&t);
    for(int cas=1;cas<=t;cas++){
        scanf("%lf%lf",&tempx,&tempy);
        r=sqrt(tempx*tempx+tempy*tempy);//反正后面要平方,所以这里可以不开方,不过这不是wr的关键
        area=PI*r*r/2;
        ans=(int)(area/50.0)+1;

        printf("Property %d: This property will begin eroding in year %d.\n",cas,ans);
    }
    printf("END OF OUTPUT.\n");

    return 0;
}



posted @ 2015-09-23 20:11  buzhidaohahaha  阅读(116)  评论(0编辑  收藏  举报