10209 - Is This Integration ?

All about problems in Volume 102. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

ferir
New poster
Posts: 1
Joined: Sat Dec 08, 2001 2:00 am

10209 - Is This Integration ?

Post by ferir » Sat Dec 08, 2001 6:26 am

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

yatsen
Learning poster
Posts: 68
Joined: Fri Nov 23, 2001 2:00 am
Location: taiwan

Post by yatsen » Tue Dec 11, 2001 5:50 am

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!

Yeamin Rajeev
New poster
Posts: 7
Joined: Wed Dec 12, 2001 2:00 am
Location: Bangladesh

Post by Yeamin Rajeev » Wed Dec 12, 2001 8:59 pm

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

yatsen
Learning poster
Posts: 68
Joined: Fri Nov 23, 2001 2:00 am
Location: taiwan

Post by yatsen » Sat Dec 15, 2001 9:07 am

I got ACCEPTED. Thanx!

Rossi
New poster
Posts: 20
Joined: Thu Mar 21, 2002 2:00 am
Location: Bangladesh

Post by Rossi » Thu Mar 21, 2002 8:56 am

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);
}
}

Stefan Pochmann
A great helper
Posts: 284
Joined: Thu Feb 28, 2002 2:00 am
Location: Germany
Contact:

Post by Stefan Pochmann » Thu Mar 21, 2002 11:53 am

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

Rossi
New poster
Posts: 20
Joined: Thu Mar 21, 2002 2:00 am
Location: Bangladesh

Post by Rossi » Thu Mar 21, 2002 12:29 pm

Thankx

AlexandreN
New poster
Posts: 27
Joined: Sun Jul 07, 2002 6:46 pm
Location: Campina Grande - Brazil
Contact:

Post by AlexandreN » Fri Jul 19, 2002 2:25 am

look at the printf. where is the \n ?
:)

haaaz
New poster
Posts: 29
Joined: Sun Sep 08, 2002 8:02 am

Post by haaaz » Sun Sep 08, 2002 8:04 am

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;
}

hts
New poster
Posts: 8
Joined: Sat Feb 22, 2003 2:56 am

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

Post by hts » Tue Apr 08, 2003 4:46 am

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 */
		);
	}
}

User avatar
yahoo
Learning poster
Posts: 93
Joined: Tue Apr 23, 2002 9:55 am

Post by yahoo » Tue Apr 08, 2003 6:32 am

Try to use PI as 2*acos(0).
Hope it can help. :-?

shahriar_manzoor
System administrator & Problemsetter
Posts: 399
Joined: Sat Jan 12, 2002 2:00 am

Post by shahriar_manzoor » Wed Apr 09, 2003 2:40 am

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

hts
New poster
Posts: 8
Joined: Sat Feb 22, 2003 2:56 am

Post by hts » Thu Apr 10, 2003 3:22 am

Implemented pi = 2*acos(0) and double... but W.A. again :( :( :( :( :( :( :cry: :cry:

binkid
New poster
Posts: 1
Joined: Fri Oct 24, 2003 1:23 am
Contact:

use higher precision

Post by binkid » Fri Oct 24, 2003 1:29 am

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

newcrama
New poster
Posts: 1
Joined: Wed Jul 07, 2004 10:11 am

10209 T_T WA

Post by newcrama » Wed Jul 07, 2004 10:18 am

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);
}
}

Post Reply

Return to “Volume 102 (10200-10299)”