Page 1 of 2
10521 - Continuously Growing Fractions
Posted: Sun Jul 06, 2003 1:54 pm
by Alexander Kozlov
Please, can sombody answer what should the correct output be
for inputs:
-5 7
34 -64
9 -5
-33 -57
123456789123456789 987654321
55555555555555555555 66666666666666666666
My program gives:
-5/7=0+1/{-1+1/{-2+1/{-2}}}
34/(-64)=0+1/{-1+1/{-1+1/{-7+1/{-2}}}}
9/(-5)=-1+1/{-1+1/{-4}}
-33/(-57)=0+1/{1+1/{1+1/{2+1/{1+1/{2}}}}}
123456789123456789/987654321=124999998+1/{1+1/{70+1/{9+1/{2170+1/{2+1/{1+1/{2+1/{1+1/{1+1/{1+1/{2}}}}}}}}}}}
55555555555555555555/66666666666666666666=0+1/{1+1/{5}}
Is this output correct?
What about brackets [34/(-64) or 34/-64 or -34/64] when Q = -64 < 0?
What the output should be if Q == 0?
Dear authors, please, give us correct output format!
Re: 10521 ... Fractions - Please, specify output format!!!
Posted: Sun Jul 06, 2003 2:23 pm
by Moni
34/(-64)=0+1/{-1+1/{-1+1/{-7+1/{-2}}}}
What about brackets [34/(-64) or 34/-64 or -34/64] when Q = -64 < 0?
Don't use (-64) use just -64
i.e. 34/-64
Posted: Sun Jul 06, 2003 4:42 pm
by Per
Alexander: Apart from output formatting, there are actual errors in your output. For instance, floor(34/-64) != 0. (Read the problem statement very carefully)
Posted: Sun Jul 06, 2003 6:31 pm
by Alexander Kozlov
Dear Moni and Per!
Thank you very much! I got AC.
Posted: Fri Jul 11, 2003 9:18 am
by Red Scorpion
What's The limit for P ? and Q ?
Posted: Fri Jul 11, 2003 9:20 am
by Dominik Michniewski
1000 or 2000 digits, I don't remember correct ...
DM
Posted: Sat Jul 12, 2003 5:39 pm
by Moni
Yeap! That was at most
2000 digits

Posted: Mon Jul 14, 2003 10:50 am
by windows2k
Alexander Kozlov wrote:Dear Moni and Per!
Thank you very much! I got AC.
Ok, can you give the right output for your input above
Thx
Posted: Mon Jul 14, 2003 2:22 pm
by Alexander Kozlov
Input :
-5 7
34 -64
9 -5
-33 -57
123456789123456789 987654321
55555555555555555555 66666666666666666666
Output:
-5/7=-1+1/{3+1/{2}}
34/-64=-1+1/{2+1/{7+1/{2}}}
9/-5=-2+1/{5}
-33/-57=0+1/{1+1/{1+1/{2+1/{1+1/{2}}}}}
123456789123456789/987654321=124999998+1/{1+1/{70+1/{9+1/{2170+1/{2+1/{1+1/{2+1/{1+1/{1+1/{1+1/{2}}}}}}}}}}}
55555555555555555555/66666666666666666666=0+1/{1+1/{5}}
Posted: Thu Aug 21, 2003 12:12 am
by Cosmin.ro
My program works on the tests posted on the webboard, but I still get wa. What is the good output for +5 +6 and 1 1, on the webboard ac results don't have spaces near = but in the problem text the examples have spaces, what is the good way? Is there any tricky input? Also I haven't seen Pascal users having solved this task. Is there any problem with using pascal?
Posted: Thu Aug 21, 2003 12:23 am
by Per
My AC solution does not handle '+' characters, but for input
output is
And you should put spaces around the '='.
Posted: Thu Aug 21, 2003 1:20 am
by Cosmin.ro
how do you test for end of line and end of file?
Posted: Fri Aug 22, 2003 4:27 pm
by Cosmin.ro
I got ac after rejudgement, thanks.
10521
Posted: Mon Sep 15, 2003 11:01 am
by babor
Hai I am getting wa
can anyone help me. Here is my code.
/*
/* @JUDGE_ID: XXXXXX 10521 C++ */
#include <stdio.h>
void main()
{
unsigned long long numar,denomi,temp;
long i,counter;
while(scanf("%llu %llu",&numar,&denomi)==2)
{
printf("%llu/%llu = %llu",numar,denomi,numar/denomi);
counter = 0;
temp = numar;
numar = denomi;
denomi = temp%denomi;
while(1 && denomi)
{
if(numar%denomi == 0)
{
printf("+1/{");
printf("%llu",numar/denomi);
counter++;
break;
}
printf("+1/{");
printf("%llu",numar/denomi);
temp = numar;
numar = denomi;
denomi = temp%denomi;
counter++;
}
for(i=0;i<counter;i++)
printf("}");
printf("\n");
}
}
/*@END_OF_SOURCE_CODE*/
*/
what is the reason . Have I missed something??????[/b]
Posted: Mon Jul 19, 2004 7:15 am
by cytmike
There may be at most 2000 digits in both P and Q.