Posted:

**Sun Sep 05, 2004 6:22 am**use long double instead of float

Page **2** of **3**

Posted: **Sun Sep 05, 2004 6:22 am**

use long double instead of float

Posted: **Sun Sep 05, 2004 8:02 am**

Hi newcrama , your method is good , the only thing that you have to do is change 3 by 3.0 or 4 by 4.0 and o by 0.0 when you use double and integer is better use 4.0 instead of 4. I modified this in your code and get AC see your PM for see the code change

Posted: **Wed Aug 30, 2006 10:04 pm**

Could any good "soul" explain me how I can reache this formulas? I tried so much to include/exclude simple geometric shapes in order to get the answer but I couldn't!

Thanks in advance!

Thanks in advance!

Posted: **Sat Jan 13, 2007 12:11 pm**

can anybody explain me how to get the formula?

i really confuse bout this one..

THx..

GBU..

i really confuse bout this one..

THx..

GBU..

Posted: **Thu Aug 02, 2007 2:59 pm**

I tried to get the equations above but I coudn't. I get 2 equations with 3 variables and I can't find the third one, to solve the system. So, I tried to integrate the equation sqrt(a^2 - x^2) + a, in the range (0, a/2), in order to get half of the square-lined area. After this integration, the formula that I get is: (a^2 * sqrt(3.0))/8.0 + (a^2 * asin(0.5) )/2.0 + (a^3)/8.0 . So I multiply this result by 2.0 and get the answer of the square-lined area. But this answer doens't work. Could anybody help me with this problem?

Thank you very much!

Thank you very much!

Posted: **Fri Aug 03, 2007 5:45 am**

Since there are codes for this problem on the board, I guess I'm not giving too much with this post, so these are the areas I used to find the formulas.

http://www.ee.furg.br/~thiago/10209.jpg

http://www.ee.furg.br/~thiago/10209.jpg

Posted: **Sat Aug 04, 2007 1:27 am**

Thank you tgoulart!

I got AC today! =D I was misusing the integral. I saw yor third figure and I figured out my error. With your third picture I got te third equation.

I'll explain how I solve this problem, since the equations given in previous codes in this forum are too hard to understand. Let's call x, y and z the pieces of the figure. So, we got the equations:

4x + y + 4z = a * a = square area

x + 2z = a*a - (PI * a * a)/4.0 = square area - 1/4 of the circle area

and the third one, the more complicated to get:

2x + 0.5y + 1.5z = integral( a^2 - sqrt(a^2 - x^2) ) in the range [0,a/2]

(try to visualize the equations above in the figure. The figures posted by tgoulart show them)

The integral is easy to find in some book and also in the internet. If someone get stuck in this part, post here and I explain how to solve the integral.

We now have 3 equations and 3 variables, so it is easy to solve using Cramer's Rule. After finding D, Dx, Dy, Dz, the answer to this problem is given by: (Dy/D, 4.0*(Dx/D), 4.0*(Dz/D)) respectively.

I got AC today! =D I was misusing the integral. I saw yor third figure and I figured out my error. With your third picture I got te third equation.

I'll explain how I solve this problem, since the equations given in previous codes in this forum are too hard to understand. Let's call x, y and z the pieces of the figure. So, we got the equations:

4x + y + 4z = a * a = square area

x + 2z = a*a - (PI * a * a)/4.0 = square area - 1/4 of the circle area

and the third one, the more complicated to get:

2x + 0.5y + 1.5z = integral( a^2 - sqrt(a^2 - x^2) ) in the range [0,a/2]

(try to visualize the equations above in the figure. The figures posted by tgoulart show them)

The integral is easy to find in some book and also in the internet. If someone get stuck in this part, post here and I explain how to solve the integral.

We now have 3 equations and 3 variables, so it is easy to solve using Cramer's Rule. After finding D, Dx, Dy, Dz, the answer to this problem is given by: (Dy/D, 4.0*(Dx/D), 4.0*(Dz/D)) respectively.

Posted: **Thu Aug 30, 2007 12:51 pm**

no need to integrate

3rd eqn: 2x+y+z=(pi/3 - sqrt(3)/4)a^2

try calculating the intersecting parts of 2 circles.

3rd eqn: 2x+y+z=(pi/3 - sqrt(3)/4)a^2

try calculating the intersecting parts of 2 circles.

Posted: **Fri Oct 19, 2007 11:56 am**

Could you please tell me why this gives me TLE

Code: Select all

```
#include<stdio.h>
int main()
{
//snipped
while(scanf("%lf", &r))
{
//snipped
}
}
```

Posted: **Fri Oct 19, 2007 12:12 pm**

Your program doesn't end..

scanf() returns**EOF** not 0 at the end of file..

Remove your code if you get AC..

scanf() returns

Remove your code if you get AC..

Posted: **Fri Oct 19, 2007 1:02 pm**

It worked!

Posted: **Fri Jan 11, 2008 6:50 pm**

bonny wrote:no need to integrate

3rd eqn: 2x+y+z=(pi/3 - sqrt(3)/4)a^2

try calculating the intersecting parts of 2 circles.

i have tried all my geometrical knowledge to figure that out.....

but i can't.

bonny or anyone else.........pls explain this...........

thanks and keep posting..........

Posted: **Tue Feb 19, 2008 12:17 am**

here's my code

can sum1 help

can sum1 help

Code: Select all

```
Code Deleted after AC
```

Posted: **Tue Feb 19, 2008 3:28 am**

I don't know if your expressions are right, but you'd better use double instead of float for real type.fR0D wrote:here's my code

can sum1 helpCode: Select all

`REMOVED`

Posted: **Mon Feb 25, 2008 8:24 pm**

thnx vry much...it worked...it will b gud if u remove the code too...