10190 - Divide, But Not Quite Conquer!

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

Moderator: Board moderators

Post Reply
necropower
New poster
Posts: 20
Joined: Wed Dec 26, 2001 2:00 am

10190 - Divide, But Not Quite Conquer!

Post by necropower »

can u guys tell me a counter-example where my program fails? i am not seeing it! and the problem looks so easy, i am fealling ashamed to ask about this one... :sad:(



#include <stdio.h>
#include <math.h>

float divider,number,temp,answer,temp2;


main()
{
int i;
number =1;
scanf("%f %f",&number,
ram
New poster
Posts: 30
Joined: Wed Mar 06, 2002 2:00 am
Contact:

Post by ram »

try "25 5" and "5 5".
Stefan Pochmann
A great helper
Posts: 284
Joined: Thu Feb 28, 2002 2:00 am
Location: Germany
Contact:

Post by Stefan Pochmann »

I had some problems with this one, too. Unfortunately, the judge thinks that if n<2 or m<2, then it's boring. Of course that's total crap, but the judge is always right...

<font size=-1>[ This Message was edited by: Stefan Pochmann on 2002-03-24 05:10 ]</font>
necropower
New poster
Posts: 20
Joined: Wed Dec 26, 2001 2:00 am

Post by necropower »

can u see any problem in that?


my input:

25 5
5 5
2 2
1 2
2 1
1 1
0 1
1 0
0 2
2 0
125 5
30 3
80 2
81 3
20000000000 2
125 125

my answer:
25 5 1
5 1
2 1
Boring!
Boring!
Boring!
Boring!
Boring!
Boring!
Boring!
125 25 5 1
Boring!
Boring!
81 27 9 3 1
Boring!
125 1
Stefan Pochmann
A great helper
Posts: 284
Joined: Thu Feb 28, 2002 2:00 am
Location: Germany
Contact:

Post by Stefan Pochmann »

Looks "correct" (meaning the judge should like it).
necropower
New poster
Posts: 20
Joined: Wed Dec 26, 2001 2:00 am

Post by necropower »

well, the judge didnt like it, and the code still the same... :sad:
ram
New poster
Posts: 30
Joined: Wed Mar 06, 2002 2:00 am
Contact:

Post by ram »

My code works fine with all the test cases. But I am getting "Output limit exceeded" when I submit it. Can any body help me with the reason????
Stefan Pochmann
A great helper
Posts: 284
Joined: Thu Feb 28, 2002 2:00 am
Location: Germany
Contact:

Post by Stefan Pochmann »

ram: That means you print to much. Either you have too much debug output (remove it) or you screw the input (fix it), so that you for example process the last testcase again and again and again. Or you have an infinite loop that prints something (fix it). Or...
ram
New poster
Posts: 30
Joined: Wed Mar 06, 2002 2:00 am
Contact:

Post by ram »

Thanks stefan,

It just got accepted. I used
"while(scanf("%lf %lf",&num,&div))"
instead of
"while((scanf("%lf %lf",&num,&div))==2)"

thanks for the reply.


<font size=-1>[ This Message was edited by: ram on 2002-03-27 01:43 ]</font>
sayeed
New poster
Posts: 8
Joined: Wed Aug 07, 2002 9:00 pm

Post by sayeed »

/*@BEGIN_OF_SOURCE_CODE*/
#include<stdio.h>
#include<math.h>


int main()

{
long long n,div,x,y;

while(scanf("%lld%lld",&n,&div)==2){

if(div < 2 || n< 2) printf("Boring!\n");

else {
x = (log10(n)/log10(div));
y = pow(div,x);
if(y != n) printf("Boring!");

else
for( ;n>=1 ;n/=div)
printf("%lld ",n);

printf("\n");
}
}



return 0;
}
/*@END_OF_SOURCE_CODE*/

**********
Can anybody help me to find out the error? All input stated here works fine
stack
New poster
Posts: 2
Joined: Fri Jun 14, 2002 6:34 am

who can tell me, what wrong with my code?

Post by stack »

program v10190;

var
n, a: double;

function isPow: boolean;
var
k: double;
begin
k := ln(n)/ln(a);

if abs(k-trunc(k)) < 1e-8 then
isPow := true
else
isPow := false;
end;

procedure solve;
begin
write(n:0:0);
while true do
begin
n := trunc(n/a);
write(' ', n:0:0);
if abs(n-1) < 1e-8 then
break;
end;
writeln;
end;

begin
{ TODO -oUser -cConsole Main : Insert code here }
while not eof do
begin
readln(n, a);
if (n < 2) or (a < 2) then
begin
writeln('Boring!');
continue;
end;
if isPow then
solve
else
writeln('Boring!');
end;
end.
new comer
New poster
Posts: 1
Joined: Sat Aug 24, 2002 2:45 pm

10190

Post by new comer »

Whenever I submitt 10190, it says "output limit exceeded". I don't understand where is the problem. My code is like this:

#include<stdio.h>
#include<math.h>

void main()
{
long m,n,result;

for(;(scanf("%ld %ld",&m,&n))==2;)
{
if((ceil(logl(m)/logl(n))) == (floor(logl(m)/logl(n))))
{
printf("%ld ",m);
for(;;)
{
m=m/n;
printf("%ld ",m);
if(m==1)
break;
}
}
else
{
printf("Boring!");
}
printf("\n");
}
}

HELP ME![/c]
henar2
New poster
Posts: 30
Joined: Mon Nov 26, 2001 2:00 am
Location: Valladolid (Spain)

Post by henar2 »

Try with input:
0 2

your program prints 0 0 0 0 0 0....................

Good luck.
deddy one
Experienced poster
Posts: 120
Joined: Tue Nov 12, 2002 7:36 pm

Post by deddy one »

actually I'm just using a simple calculation which is

if (n%i==0)
n = n/m;


using only calculation like that I got accepted in 0.00 sec.

hint : don't think too hard on this one, it's not that hard to solve this
epsilon0
Experienced poster
Posts: 112
Joined: Tue Nov 12, 2002 11:15 pm
Location: Paris, France.

Post by epsilon0 »

the judge is nuts.
1 1 should be accepted.. but it's Boring!

if (a < 2 || b < 2 || (a < b)) /* Boring! */
We never perform a computation ourselves, we just hitch a ride on the great Computation that is going on already. --Tomasso Toffoli
Post Reply

Return to “Volume 101 (10100-10199)”