488 - PRESENTATION ERROR!

All about problems in Volume IV. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

488 - PRESENTATION ERROR!

Postby TripShock » Thu Jun 22, 2006 11:28 am

this program seems t conform to all the rules but still gets PE! help!

Code: Select all
#include <iostream>

using namespace std;

int main()
{
    short a = 0;
    short f = 0;
    short n = 0;
   
    cin >> n;
   
    while(n)
    {
        cin >> a;
        cin >> f;
   
        for(char i = 1; i <= f; i++)
        {
            for(char j = 1; j <= a; j++)
            {
                for(char k = 1; k <= j; k++)
                    cout << (int)j;
                if(a != 1)
                    cout << endl;
            }
            for(char j = a - 1; j >= 1; j--)
            {
                for(char k = 1; k <= j; k++)
                    cout << (int)j;
                cout << endl;
            }
            if(!(i == f && n == 1))
                cout << endl;
        }
        n--;
    }
   
    return 0;
}
User avatar
TripShock
New poster
 
Posts: 14
Joined: Tue Jun 20, 2006 9:33 am

Postby chunyi81 » Thu Jun 22, 2006 5:21 pm

Check the output description:

The outputs of two consecutive cases will be separated by a blank line.


NOTE: There is a blank line after each separate waveform, excluding the last one


Remove your code after you get AC.
chunyi81
A great helper
 
Posts: 293
Joined: Sat Jun 21, 2003 4:19 am
Location: Singapore

Postby TripShock » Thu Jun 22, 2006 9:59 pm

Input:
1

3
2

Output:
1\n
22\n
333\n
22\n
1\n
\n
1\n
22\n
333\n
22\n
1\n


Should I remove the last '\n' ?
User avatar
TripShock
New poster
 
Posts: 14
Joined: Tue Jun 20, 2006 9:33 am

Postby chunyi81 » Sat Jun 24, 2006 11:42 am

TripShock wrote:Input:
1

3
2

Output:
1\n
22\n
333\n
22\n
1\n
\n
1\n
22\n
333\n
22\n
1\n


Should I remove the last '\n' ?


Nope. In fact this is ok. Apparently I overlooked one line of code in your program which does this. But then again to get AC you have to print a blank line after each triangle wave, which is exactly what my AC program (no PE) did. I know what my AC program did does not really conform to the output description. I will leave a post in the Bugs and Suggestions forum regarding this.
chunyi81
A great helper
 
Posts: 293
Joined: Sat Jun 21, 2003 4:19 am
Location: Singapore

Postby TripShock » Sat Jun 24, 2006 6:26 pm

I don't get it! Now i'm getting WA!!!

Code: Select all
#include <iostream>

using namespace std;

int main()
{
    short a = 0;
    short f = 0;
    short n = 0;
   
    cin >> n;
   
    while(n)
    {
        cin >> a;
        cin >> f;
   
        for(char i = 1; i <= f; i++)
        {
            for(char j = 1; j <= a; j++)
            {
                for(char k = 1; k <= j; k++)
                    cout << (int)j;
                cout << endl;
            }
            for(char j = a - 1; j >= 1; j--)
            {
                for(char k = 1; k <= j; k++)
                    cout << (int)j;
                cout << endl;
            }
            if(!(i == f && n == 1))
                cout << endl;
        }
        n--;
    }
   
    return 0;
}
User avatar
TripShock
New poster
 
Posts: 14
Joined: Tue Jun 20, 2006 9:33 am

Postby newton » Wed Jan 31, 2007 3:13 pm

Code: Select all
code is deleted after AC




tankyou very much for the example i got AC.






newton ......................... simply the best
Last edited by newton on Thu Feb 01, 2007 7:46 am, edited 1 time in total.
User avatar
newton
Experienced poster
 
Posts: 162
Joined: Thu Jul 13, 2006 7:07 am
Location: Campus Area. Dhaka.Bangladesh

Postby helloneo » Wed Jan 31, 2007 3:24 pm

Try this..

Code: Select all
2

3
2

3
2



My output

Code: Select all
1
22
333
22
1

1
22
333
22
1

1
22
333
22
1

1
22
333
22
1
Last edited by helloneo on Thu Feb 15, 2007 12:25 pm, edited 2 times in total.
helloneo
Guru
 
Posts: 516
Joined: Mon Jul 04, 2005 6:30 am
Location: Seoul, Korea

PE why???

Postby Oronno » Sun Feb 04, 2007 8:58 am

I have done this proble, and there is no space after last output.
But i still getr the presentation error.
Why???????
check it.

Code: Select all
Code has removed
Last edited by Oronno on Sun Feb 04, 2007 11:25 am, edited 1 time in total.
I like programming but i am so lazy to do it...
User avatar
Oronno
New poster
 
Posts: 21
Joined: Sun Jul 09, 2006 1:42 pm
Location: Dhaka

Postby helloneo » Sun Feb 04, 2007 9:17 am

You forgot '\n' at the end..
Just try to follow TripShock's output format above..
helloneo
Guru
 
Posts: 516
Joined: Mon Jul 04, 2005 6:30 am
Location: Seoul, Korea

thanks

Postby Oronno » Sun Feb 04, 2007 11:31 am

Ohhh...thanks.
I get AC.
Last edited by Oronno on Fri Feb 29, 2008 12:16 pm, edited 1 time in total.
I like programming but i am so lazy to do it...
User avatar
Oronno
New poster
 
Posts: 21
Joined: Sun Jul 09, 2006 1:42 pm
Location: Dhaka

Postby john_locke » Sun Feb 04, 2007 9:17 pm

this problem drove me toward madness i got 20 presentation errors from judge tried all the combinations after reading previous post so plzzz help me

DELETED after -AC
thanx




john_locke
New poster
 
Posts: 13
Joined: Sat Oct 07, 2006 6:42 pm

Postby ranacse05 » Sat Apr 14, 2007 12:48 pm

Why output Limit E...??????


*************code removed***************
Last edited by ranacse05 on Tue Apr 24, 2007 7:46 pm, edited 1 time in total.
I like to solve problems.
ranacse05
New poster
 
Posts: 37
Joined: Wed Mar 28, 2007 5:08 pm
Location: Rajshahi

Postby Jan » Sat Apr 14, 2007 3:07 pm

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.
Ami ekhono shopno dekhi...
HomePage
Jan
Guru
 
Posts: 1334
Joined: Wed Jun 22, 2005 10:58 pm
Location: Dhaka, Bangladesh

Postby ranacse05 » Sat Apr 14, 2007 3:55 pm

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;
}
I like to solve problems.
ranacse05
New poster
 
Posts: 37
Joined: Wed Mar 28, 2007 5:08 pm
Location: Rajshahi

Postby Rocky » Wed Apr 18, 2007 10:02 am

to rana:

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

GOOD LUCK
rocky
User avatar
Rocky
Experienced poster
 
Posts: 124
Joined: Thu Oct 14, 2004 9:05 am

Next

Return to Volume IV

Who is online

Users browsing this forum: No registered users and 1 guest