Page 8 of 19

Posted: Sat Apr 14, 2007 12:48 pm
by ranacse05
Why output Limit E...??????


*************code removed***************

Posted: Sat Apr 14, 2007 3:07 pm
by Jan
Check your code carefully.

Code: Select all

for(i=0;i<num;i++)
    ...
    for(k=0;k<b;k++)
        ...
        for(i=0;i<a;i++)  // i again ???
            ...
Hope it helps.

Posted: Sat Apr 14, 2007 3:55 pm
by ranacse05
Why PE ?
plz help me
#include "stdio.h"

int main()
{
int a,b,i,j,k,num;


while(scanf("%d",&num)==1)
{
for(i=0;i<num;i++)
{
scanf("%d %d",&a,&b);
printf("\n");
for(k=0;k<b;k++)
{
for(i=0;i<a;i++)
{ for(j=0;j<i+1;j++)
printf("%d",i+1);
printf("\n");
}

for(i=a-2;i>=0;i--)
{ for(j=0;j<i+1;j++)
printf("%d",i+1);
printf("\n");
}
printf("\n");
}
printf("\n");

}
}
return 0;
}

Posted: Wed Apr 18, 2007 10:02 am
by Rocky
to rana:

is u sure your programm get pe????.....i submitted it and get output limit exit....

GOOD LUCK
rocky

Posted: Thu Apr 19, 2007 9:25 pm
by ranacse05
Rocky try this :
#include "stdio.h"

int main()
{
int a,b,i,j,k,l,num,count,total;
total=0;
while(scanf("%d",&num)==1)
{
count=0;
for(l=0;l<num;l++)
{
scanf("%d %d",&a,&b);
printf("\n");
total+=b;
for(k=0;k<b;k++)
{
for(i=0;i<a;i++)
{
for(j=0;j<i+1;j++)
printf("%d",i+1);
printf("\n");
}
count++;
for(i=a-2;i>=0;i--)
{
for(j=0;j<i+1;j++)
printf("%d",i+1);
printf("\n");
}
if(count!=total)
printf("\n");
}

}
}

return 0;
}


But why PE????????????

ok

Posted: Sat Apr 21, 2007 8:57 am
by Rocky
ok i check ur previous code which is ouput limit exit and it is now ok....i send it to u via pm.check it..

GOOD LUCK
rocky

Posted: Mon May 07, 2007 8:43 am
by m2lajoo
You didn't understand the problem well
it is not EOF It has test cases
for example:
input:
1
3
2
output:

1
22
333
22
1

1
22
333
22
1
yor code doesn't go out of program but it should.
sorry for my bad english.
#include<smile.h>
regards

Here is my code & i got PE. Ples help me if any mistakes

Posted: Wed May 09, 2007 10:13 pm
by turcse143
#include <stdio.h>
void main(void)
{

unsigned long i,j,k,amp,freq,count,m,n,l;

count=0;
//freopen("input3.in","r",stdin);
scanf("%lu",&n);
for(l=1;l<=n;l++)
{
scanf("%lu %lu",&amp,&freq);

// if(count!=0)
//printf("\n");

if(amp==0)
{
for(i=0;i<freq;i++)
if(i!=freq-1)
// printf("\n");
// count++;
continue;
}

for(i=0;i<freq;i++)
{
//if(count!=0)
// printf("\n");

for(j=1;j<=amp;j++)
{
for(k=0;k<j;k++)
printf("%lu",j);
printf("\n");
}

for(j=amp-1;j>=1;j--)
{
for(k=0;k<j;k++)
printf("%lu",j);
if(j!=1)
printf("\n");
}
if(i==freq-1&&l==n)
continue;
else if(i!=freq-1||l!=n)
printf("\n\n");



}

//count++;
if(l!=n)
//break;
//else
printf("\n");
}


}

Posted: Thu May 10, 2007 2:08 pm
by Jan
Search the board first. Don't open a new thread if one already exists. If there is no thread then you can open a new one. But then you should specify the problem name.

488, PE,PLES help

Posted: Fri Jun 22, 2007 5:53 pm
by turcse143
2

4
3

1
22
333
4444
333
22
1

1
22
333
4444
333
22
1

1
22
333
4444
333
22
1
3
2

1
22
333
22
1

1
22
333
22
1

Here is my code i got PE PLES Help.
Note: There is no '\n' in my output in last case. So what is the problem??

Posted: Fri Jun 22, 2007 7:20 pm
by Jan
Search the board first. Don't open a new thread if there is one already.

Posted: Mon Jul 16, 2007 10:38 pm
by camiloreis84
I put this code e i had PE too, someone could see what's wrong?

Code: Select all

#include<stdio.h>

int main(){
  int n, amp, hz, i, j, l, k;
  
    scanf("%d", &n);
  
    for(k = 1; k <= n; k++){
      if(k > 1)
        printf("\n");
       
      scanf("%d", &amp);
      scanf("%d", &hz); 
      for(l = 1; l <= hz; l++){
        for(i = 1; i <= amp; i++){
          for(j = 1; j <= i; j++)
            printf("%d", i);
       
          printf("\n");    
        }
        for(i = amp-1; i >= 1; i--){
          for(j = 1; j <= i; j++)
            printf("%d", i);
       
          if(l == hz && i == 1 && k == n)
            continue;
          else
            printf("\n");          
        }
        if(l != hz)
          printf("\n");
        }
      
    }      
}

Posted: Wed Jul 25, 2007 8:01 pm
by Sayeef
I've tried everything and still PE help plese

Code: Select all

#include<stdio.h>

main()
{
 int i,j,k,p,f=1;
 int amp=0,freq=0,test=0;
	scanf("%d",&test);
	for(p=1;p<=test;p++)
	{

	scanf("%d",&amp);
	scanf("%d",&freq);
	
	for(i=1;i<=freq;i++)
	{
		for(j=1;j<=amp;j++)
			{
			for(k=1;k<=j;k++)
				{
					printf("%d",j);

				}
				printf("\n");
			}
		for(j=amp-1;j>=1;j--)
			{
			for(k=1;k<=j;k++)
			{
				printf("%d",j);

			}
			printf("\n");
	   }
	if(i!=freq)
	  printf("\n"); 
	}
  }
 return 0;
}

Posted: Sun Aug 26, 2007 7:26 am
by rongtuli
to muhin,
omit the first two printf("\n");

488 TLE

Posted: Sat Nov 03, 2007 4:25 am
by Justin darkwing

Code: Select all

#include<iostream>
using namespace std;
int main()
{
	int x,i,j,a=0,b=0,c=1;
 	cin>>x;

		while(x--)
		{
				i=0;j=0;
				cin>>i>>j;
		
			while(j--)
			{
			
				a=0;b=0;c=1;
				for(a=1;a<=i;a++)
				{
					for(b=0;b<a;b++)
					{
						 cout<<c;
			
					}
					c++;
					 cout<<endl;
				}
				c=i-1;
				for(a=i;a>0;a--)
				{
					for(b=1;b<a;b++)
					{
						cout<<c;
			
					}
					c--;
				if(c==0&j==0)continue;
				 cout<<endl;
				}
				
			}
		}
//system("pause");
	
	return 0;
}

Can anybody tell me why I got a TLE,please?????