10573 - Geometry Paradox

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

Moderator: Board moderators

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

Mistake

Post by shahriar_manzoor » Fri Oct 17, 2003 5:16 pm

Sorry! Although the problem statement says floating point, all the judge inputs are integers. I think in my defense I can say "All integers are floating point numbers" :) like "All alkalies are base" in chemistry days.

hito
New poster
Posts: 1
Joined: Sat Oct 25, 2003 7:39 am
Location: Taiwan

Edit

Post by hito » Sat Oct 25, 2003 8:09 am

Hi,I want to say something first...my English is pool...
But I got A.C. and also think the problem is beautiful and clear enough...

if r1=r2,
then r1+r2=R=t/2
so R^2=t^2/4
the gray area=(t^2/4)*pi-2*(t^2/16)*pi=(t^2/8)*pi

else r1!=r2
then (r1+r2)^2=(r1-r2)^2+(t/2)^2
we can get 4*r1*r2=(t/2)^2
by the problem,t value must be integer,
so r1=k^2*r2(k is rational number)
if not, t will be irrational number,
so 4*k^2*r2^2=(t/2)^2
then we can got r2=t/4k,r1=tk/4
so the big circle area:
(t/4k + tk/4)^2*pi=(t^2/16k^2+t^2*k^2/16+t^2/8)*pi
the gray area still (t^2/8)*pi....

so the two pictures that post before maybe correct,
but the area of gray part maybe have precision errors,
or it will be the same.

This is my first post here,if I make a mistake,plz let me know.
Hope this will be a little help...

pavelph
Learning poster
Posts: 57
Joined: Wed Dec 10, 2003 7:32 pm
Location: Russia, Saint-Petersburg

10573 - Help please

Post by pavelph » Sat Jan 24, 2004 10:27 pm

As I understand if in input "t" then write “Impossible.” else write area of grey part. Am I right???

User avatar
shamim
A great helper
Posts: 498
Joined: Mon Dec 30, 2002 10:10 am
Location: Bozeman, Montana, USA

Post by shamim » Sun Jan 25, 2004 5:46 am

Well not quite.
I will give you one hint, the part about "Impossible" here is only for confusing. My AC program does not consider cases where output will be "Impossible". :wink:

pavelph
Learning poster
Posts: 57
Joined: Wed Dec 10, 2003 7:32 pm
Location: Russia, Saint-Petersburg

Post by pavelph » Sun Jan 25, 2004 7:40 pm

I think that with <const t> and different <Radius of big circle> we will have different answers :-?

Eduard
Experienced poster
Posts: 183
Joined: Fri Sep 26, 2003 2:54 pm
Location: Armenia,Yerevan

10573WA

Post by Eduard » Tue Apr 06, 2004 10:29 am

Please help i don't know were is an error i thing my formula is right.
[pascal]var t,i,j,k,n:longint;
r:array[1..3] of longint;
rr:real;
begin
readln(n);
for j:=1 to n do
begin
k:=0;
while not eoln do
begin
inc(k);
read(r[k]);
if k=2 then break;
end;
if j<>n then readln;
if k=2 then rr:=2*pi*r[1]*r[2]
else rr:=(pi*r[1])/8;
writeln(rr:0:4);
end;
end.[/pascal]
someone who like to solve informatic problems.
http://acm.uva.es/cgi-bin/OnlineJudge?AuthorInfo:29650

Eduard
Experienced poster
Posts: 183
Joined: Fri Sep 26, 2003 2:54 pm
Location: Armenia,Yerevan

10573 Help Please

Post by Eduard » Mon Apr 12, 2004 9:55 pm

I put this question in Volume CV, but did not get answer.
I put it here because I think my problem is with input. Plase help me. What is wrong with my program why I'm getting WA.
[pascal]var t,i,j,k,n:longint;
r:array[1..3] of longint;
rr:double;
begin
readln(n);
for j:=1 to n do
begin
k:=0;
while not eoln do
begin
inc(k);
read(r[k]);
if k=2 then break;
end;
if j<>n then readln;
if k=2 then rr:=2*pi*r[1]*r[2]
else rr:=(pi*r[1])/8;
writeln(rr:0:4);
end;
end. [/pascal]
someone who like to solve informatic problems.
http://acm.uva.es/cgi-bin/OnlineJudge?AuthorInfo:29650

Observer
Guru
Posts: 570
Joined: Sat May 10, 2003 4:20 am
Location: Hong Kong

Post by Observer » Tue Apr 13, 2004 3:17 pm

No. Your formula for the "one integer" case is wrong. Check that again.
7th Contest of Newbies
Date: December 31st, 2011 (Saturday)
Time: 12:00 - 16:00 (UTC)
URL: http://uva.onlinejudge.org

Eduard
Experienced poster
Posts: 183
Joined: Fri Sep 26, 2003 2:54 pm
Location: Armenia,Yerevan

Post by Eduard » Tue Apr 13, 2004 4:50 pm

Thank you i did not sea that write the second formula wrong.
I get AC.
someone who like to solve informatic problems.
http://acm.uva.es/cgi-bin/OnlineJudge?AuthorInfo:29650

MarC
New poster
Posts: 1
Joined: Tue May 04, 2004 9:05 pm
Contact:

10573 error in problem specifications (non integer data!!)

Post by MarC » Tue May 04, 2004 9:26 pm

there have been a lot of discussions about this problem...
but, in my opinion, the clue is that in the problem's text, they say "each set contains two integer. If it contains one integer..."
but in the judge's files, there is one test with double data!!!

that's why i got a thousand times WA!

I expect they will fix this error!!!

User avatar
UFP2161
A great helper
Posts: 277
Joined: Mon Jul 21, 2003 7:49 pm
Contact:

Post by UFP2161 » Wed May 05, 2004 4:05 am

No, it says "Each set either contains one or two integer."

Thus, a line like "5 1.1161" contains only one integer, and is technically valid.

ansiemens
New poster
Posts: 6
Joined: Tue Aug 09, 2005 11:24 am
Location: New York, NY

10573 Geometry Paradox ~WA

Post by ansiemens » Wed Aug 31, 2005 3:54 pm

HI! I always got WA. I don't know whats wrong with it.
can anyone tell me?

Code: Select all

#include<iostream>
#include<sstream>
#include<string>
using namespace std;

const double M_PI=3.14159265358979323846;

int main() {
    int n,r1,r2,t;
    string input;
    cin >> n; cin.ignore();
    cout.setf(ios::fixed);
    cout.precision(4);
    while(n--) {
        getline(cin,input);
        if(input[1]==0 || input[2]==0) {
            istringstream(input) >> t;
            cout << t*t*(M_PI/8.0) << endl;
        }
        else {
            istringstream(input) >> r1 >> r2;
            cout << r1*r2*(2.0*M_PI) << endl;
        }
    }
    return 0;
}

User avatar
Sedefcho
A great helper
Posts: 374
Joined: Sun Jan 16, 2005 10:18 pm
Location: Bulgaria

Post by Sedefcho » Fri Sep 09, 2005 11:45 am

The formulas you use are obviously OK.
Try to simplify the way you read the input. That should
be your problem. You may want to use simpler functions
( pure C functions ) like gets() and sscanf().

User avatar
kbr_iut
Experienced poster
Posts: 103
Joined: Tue Mar 25, 2008 11:00 pm
Location: IUT-OIC, DHAKA, BANGLADESH
Contact:

Re: 10573 - Geometry Paradox(precisition error.pliz anyone help)

Post by kbr_iut » Sun May 04, 2008 12:40 am

code deleted.Now AC,thanx obaida
Last edited by kbr_iut on Sun May 04, 2008 8:11 am, edited 1 time in total.
It is tough to become a good programmer.
It is more tough to become a good person.
I am trying both...............................

Obaida
A great helper
Posts: 380
Joined: Wed Jan 16, 2008 6:51 am
Location: (BUBT) Dhaka,Bagladesh.

Re: 10573 - Geometry Paradox

Post by Obaida » Sun May 04, 2008 6:21 am

If only t is given, you can assume that r1 = r2, t become the diameter of the outer circle :) Thus the area of the outer circle becomes PI*(t/2)*(t/2) and area of the two identical inner circles become 2*PI*(t/4)*(t/4), thus the area of the gray part = (PI*t*t)/4 - (PI*t*t)/8 = (PI*t*t)/8.
If there are r1 and r2, then gray part =2*PI*r1*r2.
And there is no impossible case. 8)
try_try_try_try_&&&_try@try.com
This may be the address of success.

Post Reply

Return to “Volume 105 (10500-10599)”