Page 7 of 8

10190 why runtime error?

Posted: Sun Aug 15, 2010 6:57 am
by @mjad
anybody please help me

Code: Select all

#include<stdio.h>

int main()
{
    long int n,b;
	long int a[200000],i,j;

	//freopen("10190.txt","r",stdin);
	while(scanf("%ld %ld",&n,&b)==2)
	{
		 
		i=0;
		if(b==0||n==0||(n==1&&b==1)||n<b)
		{
			printf("Boring!");
			goto l;
		}
		while(n>0)
		{
			if(n%b==0||(n==1)){
				 
				a[i]=n;
				n/=b;
				i++;
			}
			else 
			{
				printf("Boring!");
				goto l;
			}
			 
		}
		for(j=0;j<i;j++)
			printf("%ld ",a[j]);
	 
l:
		printf("\n");


	}
   
    return 0;
}


10190why runtime error? please help me!

Posted: Sun Aug 15, 2010 7:09 am
by @mjad
:D
i go AC
thanx a lot for your reply

10190why presentation error?

Posted: Sun Aug 15, 2010 7:58 am
by @mjad
please anybody help me
why presentation error?
i think this is write ,
but i don't get AC

my code is here
please any body help me
here is my code

Code: Select all

#include<stdio.h>
#include<queue>
using namespace std;
int main()
{
    long int n,b;

	while(scanf("%ld %ld",&n,&b)==2)
	{
		 queue<long int>q;

		if(n<=1||b<=1)
		{
			printf("Boring!");
			goto l;
		}
		while(n>0)
		{
			if(n%b==0||(n==1)){
				 
				q.push(n);
				n/=b;
				
			}
			else 
			{
				printf("Boring!");
				goto l;
			}
			 
		}
		while(!q.empty())
		{
			printf("%ld ",q.front());
			q.pop();
		}
	 
l:
		printf("\n");


	}
   
    return 0;
}


Re: 10190why presentation error?

Posted: Sat Oct 09, 2010 8:15 pm
by helloneo
@mjad wrote:please anybody help me
why presentation error?
i think this is write ,
but i don't get AC

my code is here
please any body help me
here is my code
You're printing an extra space after the last number..

Re: 10190 TE why? please help me any body

Posted: Thu Aug 18, 2011 10:37 pm
by shoaib7k
i got presentation error... here is my code...[/code] #include<stdio.h>
int main()
{
int n,m,k,i,j,a[200000];
while(scanf("%d%d",&n,&m)!=EOF)
{
i=0;
if(m<2 || n<m)
{
printf("Boring!");
goto l;
}
while(n>0)
{
if(n%m==0 || n==1)
{
a=n;
n/=m;
i++;
}
else
{
printf("Boring!");
goto l;
}
}
for(j=0;j<i;j++)
printf("%d ",a[j]);
l:
printf("\n");
}
return 0;
}

Re: 10190 TE why? please help me any body

Posted: Tue Oct 11, 2011 8:23 pm
by Imran Bin Azad
you are printing an extra white space after the last integer

Code: Select all

for(j=0;j<i;j++)
printf("%d ",a[j]);

Re: 10190 TE why? please help me any body

Posted: Wed Nov 02, 2011 9:19 pm
by quietroit
you are printing an extra white space after the last integer
Is this what causing a problem?

Re: 10190 - Divide, But Not Quite Conquer!

Posted: Thu Nov 03, 2011 9:41 pm
by Atish
if(n>=n&&n!=0&&m!=0&&m!=1&&n!=1) just use this condition and check your printf

Re: 10190

Posted: Thu Nov 03, 2011 9:44 pm
by Atish
new comer wrote: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)))) // you should use a condition here and check printf
{
printf("%ld ",m);
for(;;)
{
m=m/n;
printf("%ld ",m);
if(m==1)
break;
}
}
else
{
printf("Boring!");
}
printf("\n");
}
}

HELP ME![/c]

Re: 10190 - Divide, But Not Quite Conquer!

Posted: Tue Mar 20, 2012 10:55 am
by shoaib7k
what is wrong with my code???

Code: Select all

#include<stdio.h>
int main()
{
    int n,m,k,i,h,a[100];
    while(scanf("%d%d",&n,&m)==2)
    {
      if(m<2 || n<2 || n<m)
      printf("Boring!");
      else
      {
      k=1;
      a[0]=n;
      for(i=1;i<=100;i++)
      {
        a[i]=n/m;
        n=a[i];
        if(n==0)
        break;
        k++;
      }
      for(i=0;i<k-1;i++)
      {
        if(a[i]%m!=0)
        {
          printf("Boring!");
          goto l;
          h=a[i];
          break;
        }
      }
      for(i=0;i<k;i++)
      printf("%d ",a[i]);
      }
 l:     printf("\n");
    }
    return 0;
}

Re: 10190 TE why? please help me any body

Posted: Tue Mar 20, 2012 12:54 pm
by shoaib7k
now i get wrong answer.....

Re: 10190 - Divide, But Not Quite Conquer!

Posted: Tue Mar 20, 2012 9:32 pm
by brianfry713
you are printing an extra white space after the last integer

Re: 10190 - Divide, But Not Quite Conquer!

Posted: Tue Mar 20, 2012 10:12 pm
by shoaib7k
still wrong ans....

10190 Why RE??

Posted: Sat Dec 14, 2013 12:49 am
by sajal2k8

Code: Select all

#include <iostream>

using namespace std;

int main()
{
    unsigned long long int n,j,m,i=1,num[10000],a,c=0;
    while(cin>>n>>m)
    {
        num[0]=n;
        if(n==1)
        c=1;
        while(n>1 && m!=1)
        {
            a=n/m;
            if(n%m==0)
            num[i]=a;
            else
            {
                c=1;
                break;
            }
            n=n/m;
            i++;
        }
        if(m==1 || n==0)
        c=1;
        if(c==1)
        cout<<"Boring!\n";
        else
        {
            for(j=0;j<i;j++)
            {
                cout<<num[j];
                if(j!=i-1)
                cout<<" ";
            }
            cout<<"\n";
        }
        i=1;c=0;
    }
    return 0;
}
Thanks in advance..

Re: 10190 Why RE??

Posted: Tue Dec 17, 2013 11:00 pm
by brianfry713
What if m = 0?