10190  Divide, But Not Quite Conquer!
Moderator: Board moderators

 New poster
 Posts: 20
 Joined: Wed Dec 26, 2001 2:00 am
10190  Divide, But Not Quite Conquer!
can u guys tell me a counterexample 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>
float divider,number,temp,answer,temp2;
main()
{
int i;
number =1;
scanf("%f %f",&number,
#include <stdio.h>
#include <math.h>
float divider,number,temp,answer,temp2;
main()
{
int i;
number =1;
scanf("%f %f",&number,

 A great helper
 Posts: 284
 Joined: Thu Feb 28, 2002 2:00 am
 Location: Germany
 Contact:

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

 A great helper
 Posts: 284
 Joined: Thu Feb 28, 2002 2:00 am
 Location: Germany
 Contact:

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

 A great helper
 Posts: 284
 Joined: Thu Feb 28, 2002 2:00 am
 Location: Germany
 Contact:
/*@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
#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
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(ktrunc(k)) < 1e8 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(n1) < 1e8 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.
var
n, a: double;
function isPow: boolean;
var
k: double;
begin
k := ln(n)/ln(a);
if abs(ktrunc(k)) < 1e8 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(n1) < 1e8 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.
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]
#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]