网络赛前10奖励计蒜客的本子或鼠标垫(外校也可以来现场领取)
Xidian Online Judge WebBoard
[ New Thread ]
Problem 1021 >> Why is the answer wrong?
07126038 @ 2015-05-03 19:05:19
[ Quote ] [ Edit ] [ Delete ] 1#
This my code,and i can‘t find where is wrong,could you help me ,thanks very much!

#include <stdio.h>
#include <math.h>
#define PI 3.1415926

int main()
{
int n,t,i;
float a,s;
scanf("%d",&t);
for(i=0;i<t;i++)
{
scanf("%d",&n);
scanf("%f",&a);
s=n*a*a/tan(PI/n)/4;
printf("%.4f\n",s);
}
return 0;
}
xry111 @ 2015-05-03 19:26:17
[ Quote ] [ Edit ] [ Delete ] 2#
float is not precise enough. Use double instead.
[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