Page **1** of **3**

### 10209 - Is This Integration ?

Posted: **Sat Dec 08, 2001 6:26 am**

by **ferir**

is the example input right

in my view:

0.1

0.2

0.3

output should be :

0.003 0.005 0.002

0.012 0.019 0.009

0.027 0.043 0.020

Posted: **Tue Dec 11, 2001 5:50 am**

by **yatsen**

I got WA for this problem:10209.

I think my math logic is right.

But I made some mistake in dealing with the digits. Could anyone tell me what is the value of PI? I don't think 3.14159 is good enough for this problem. Thank you!

Posted: **Wed Dec 12, 2001 8:59 pm**

by **Yeamin Rajeev**

You may try PI = 2.0*acos(0.0);

Posted: **Sat Dec 15, 2001 9:07 am**

by **yatsen**

I got ACCEPTED. Thanx!

Posted: **Thu Mar 21, 2002 8:56 am**

by **Rossi**

i calculated the constants by pure math.whats wrong with it.thanks

#include<stdio.h>

#include<math.h>

void main(void)

{

register int i;

double a,x,y,z,temp,pi_3,sqrt3,cx,cy,cz;

pi_3=2.0*acos(0.0)/3.0;

sqrt3=sqrt(3.0);

cx=(4.0-sqrt3-(2.0*pi_3));

cy=(pi_3+(2.0*sqrt3)-4.0);

cz=(pi_3+1.0-sqrt3);

while(1){

if(scanf("%lf",&a)!=1)

break;

x=a*a*cx;

y=a*a*cy;

z=a*a*cz;

printf("%.3lf %.3lf %.3lfn",z,y,x);

}

}

Posted: **Thu Mar 21, 2002 11:53 am**

by **Stefan Pochmann**

Check your mail program. I just got your program accepted without changes.

Posted: **Thu Mar 21, 2002 12:29 pm**

by **Rossi**

Thankx

Posted: **Fri Jul 19, 2002 2:25 am**

by **AlexandreN**

look at the printf. where is the \n ?

Posted: **Sun Sep 08, 2002 8:04 am**

by **haaaz**

This must work:

#include <iostream.h>

#include <iomanip.h>

int main5() {

double a;

cout.setf(ios::fixed);

cout.precision(3);

while(cin>>a) {

cout << a*a*0.3151467436277204526267681195873 << ' '

<< a*a*0.51129916633435233320910714410491 << ' '

<< a*a*0.17355409003792721416412473630779 << endl;

}

return 0;

}

### 10209: Is this integration? WA!!@@#!

Posted: **Tue Apr 08, 2003 4:46 am**

by **hts**

http://acm.uva.es/p/v102/10209.html
I derived the area of the regions the problem asked, then I implemented it on my solution.

It worked well with all tests cases, by I only got WA :/

Can anyone help-me on this?

Code: Select all

```
#include <stdio.h>
#define PI 3.1415926535897932384626433832795
#define SQUARE_3 1.73205080756887729352744634150587
int main(){
float a;
while(scanf("%f", &a) == 1)
{
a = a*a;
printf("%.3f %.3f %.3f\n",
0.315147*a, /* (1+PI/3-SQUARE_3)*a, */
0.511299*a, /* 4*(-1+PI/12+SQUARE_3/2)*a, */
0.173554*a /* 4*(1-PI/6-SQUARE_3/4)*a */
);
}
}
```

Posted: **Tue Apr 08, 2003 6:32 am**

by **yahoo**

Try to use PI as 2*acos(0).

Hope it can help.

Posted: **Wed Apr 09, 2003 2:40 am**

by **shahriar_manzoor**

I have not ckecked your solution but I guess float is not enough for this problem. Use double.

Posted: **Thu Apr 10, 2003 3:22 am**

by **hts**

### use higher precision

Posted: **Fri Oct 24, 2003 1:29 am**

by **binkid**

Neither float nor double, the problem is the precision of the constant that your're using to multiply a

### 10209 T_T WA

Posted: **Wed Jul 07, 2004 10:18 am**

by **newcrama**

I derived the problem , but it always says WA. I don't know why

The program like this

#include<stdio.h>

#include<math.h>

#define PI 2*acos(0)

#define sqrt_result sqrt(3)

void main()

{

float length,a,result_A,result_B,result_C;

while((scanf("%f",&length))!=EOF)

{

length=length*length;

result_A=(1+PI/3-sqrt_result)*length;

result_B=(PI/3-4+2*sqrt_result)*length;

result_C=(4-(2*PI)/3-sqrt_result)*length;

printf("%.3f %.3f %.3f\n",result_A,result_B,result_C);

}

}