## 10190 - Divide, But Not Quite Conquer!

Moderator: Board moderators

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

### 10190 - Divide, But Not Quite Conquer!

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... (

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

main()
{
int i;
number =1;
scanf("%f %f",&number,

ram
New poster
Posts: 30
Joined: Wed Mar 06, 2002 2:00 am
Contact:
try "25 5" and "5 5".

Stefan Pochmann
A great helper
Posts: 284
Joined: Thu Feb 28, 2002 2:00 am
Location: Germany
Contact:
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
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

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:
Looks "correct" (meaning the judge should like it).

necropower
New poster
Posts: 20
Joined: Wed Dec 26, 2001 2:00 am
well, the judge didnt like it, and the code still the same...

ram
New poster
Posts: 30
Joined: Wed Mar 06, 2002 2:00 am
Contact:
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:
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:
Thanks stefan,

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

<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
/*@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?

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
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

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
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
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.
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