Re: 10190 - Divide, But Not Quite Conquer!
Posted: Sun May 03, 2015 6:35 am
I am getting WA. I have tested all the cases shared on this forum, all are ok. Can anyone give some more input-output for this problem?
Whats wrong in my code? Here is my code:
Whats wrong in my code? Here is my code:
Code: Select all
#include <iostream>
#include <math.h>
#include <stdio.h>
int main()
{
int n, m, i=1, d, p1, pwr;
double p, pw;
while(scanf("%d %d", &n, &m)!=EOF)
{
if(m<2 || n<2 || n<m)
{
printf("Boring!\n");
continue;
}
p=log(n)/log(m);
p1=(int)p;
pw=pow(m, p1);
pwr=(int)pw;
if(pwr!=n)
printf("Boring!\n");
else
{
d=n;
while(d>1)
{
printf("%d ", d);
d/=m;
}
printf("%d\n",d);
}
}
return 0;
}