欢迎加入西电微软俱乐部招新群 588166170,做出福利题,免技术部第一次面试且赠送“福利”海报或小礼品~~~~
Xidian Online Judge WebBoard
[ New Thread ]
Problem 1021 >> 帮忙看一下答案错误
07124013 @ 2015-05-01 19:44:50
[ Quote ] [ Edit ] [ Delete ] 1#
#include<stdio.h>
#include<math.h>
int main()
{
freopen("input.txt","r",stdin);
int n,a,i;
double l,ans;
scanf("%d",&a);
for(i=0;i<a;i++)
{
scanf("%d%lf",&n,&l);
ans=n*l*l/tan(3.14159/n)/4;
printf("%.4f\n",ans);
}
return 0;
}
xry111 @ 2015-05-01 21:18:26
[ Quote ] [ Edit ] [ Delete ] 2#
3.14159 is not equal to pi.
07124013 @ 2015-05-01 22:30:22
[ Quote ] [ Edit ] [ Delete ] 3#
我用 M_PI,添加了math.h了编译错误了
xry111 @ 2015-05-01 23:42:46
[ Quote ] [ Edit ] [ Delete ] 4#
use 3.1415926535897932 or acos(-1)
[Top] [Previous Page] [Next Page]
Anything about the Problems, Please Contact Admin:admin
All Copyright Reserved 2010-2014 Xidian ACM Online Judge TEAM
GPL2.0 2003-2014 HUSTOJ Project TEAM