10521 - Continuously Growing Fractions
Moderator: Board moderators
-
- New poster
- Posts: 23
- Joined: Sun Jun 15, 2003 4:45 pm
- Location: Ukraine
10521 - Continuously Growing Fractions
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!
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!
-
- Experienced poster
- Posts: 202
- Joined: Fri Mar 22, 2002 2:00 am
- Location: Chittagong. CSE - CUET
- Contact:
Re: 10521 ... Fractions - Please, specify output format!!!
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
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

-
- New poster
- Posts: 23
- Joined: Sun Jun 15, 2003 4:45 pm
- Location: Ukraine
-
- Experienced poster
- Posts: 192
- Joined: Sat Nov 30, 2002 5:14 am
-
- Guru
- Posts: 834
- Joined: Wed May 29, 2002 4:11 pm
- Location: Wroclaw, Poland
- Contact:
-
- New poster
- Posts: 23
- Joined: Sun Jun 15, 2003 4:45 pm
- Location: Ukraine
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}}
-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}}
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?
My AC solution does not handle '+' characters, but for input
output is
And you should put spaces around the '='.
Code: Select all
5 6
1 1
Code: Select all
5/6 = 0+1/{1+1/{5}}
1/1 = 1
10521
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]
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]
babor