## 488 - Triangle Wave

Moderator: Board moderators

Guru
Posts: 724
Joined: Wed Dec 19, 2001 2:00 am
Location: Germany
I think you didn't read the description of multiple input, because then you must have understand that the first input line is the number of test cases following.
Last edited by Adrian Kuegel on Sat Aug 10, 2002 2:12 pm, edited 1 time in total.

liusu
New poster
Posts: 22
Joined: Thu Aug 01, 2002 10:26 am

### Thank you!

Thank you very much! now,with your few words,i understand the prblem..
thanks again!

Noim
Learning poster
Posts: 88
Joined: Sun Oct 13, 2002 6:11 am
You have to consider about MULTIPLE input segment. (BLUE flag)....

First you will scan an integer which means the number of input you have
to proceed.

then you wil make loop as many as the numbers you scan

Remember , you will print a blank line after a set of output.

FlyDeath
Learning poster
Posts: 73
Joined: Wed Jan 02, 2002 2:00 am
Location: Taiwan
[cpp]
#include<stdio.h>

void main(){
int i,j,k,m,n;
while(scanf("%d %d",&i,&m)==2){
for(n=1;n<(m+1);n++)
{
for(j=1;j<i;j++){
for(k=1;k<(j+1);k++){
printf("%d",j);
}
printf("\n");
}

for(k=1;k<(i+1);k++){
printf("%d",i);
}
printf("\n");

for(j=(i-1);j>0;j--){
for(k=1;k<(j+1);k++){
printf("%d",j);
}
printf("\n");
}
if (n!=m) printf("\n");
}
}
}
[/cpp]

I think you misunderstood the problem.See the description more carefully.

danielrocha
New poster
Posts: 44
Joined: Sun Apr 27, 2003 3:17 am
Location: Rio Grande do Norte - Brazil
Contact:

### 488 - Accepted but P.E.

Hello everyone, I've got accepted at problem 488 (yes, I know it's a multiple input problem), but the judge says "Presentation Error". Anyone with the same problem? Don't know what to do, I've tried pretty much everything...
My code is below, thanks and greets from Brazil Daniel

[cpp]
#include <iostream>
#include <stdio.h>

using namespace std;

int main() {
int l,i,j,k,ampl,freq,numrep;

scanf("%d",&numrep);
for (l=1;l<=numrep;l++) {
scanf("%d %d",&ampl,&freq);
for (k=1;k<=freq;k++) {
// prints the 1st "peak" of the wave
for (i=1;i<=ampl;i++) {
for (j=1;j<=i;j++)
cout << i;
cout << endl;
}
// prints the 2nd part of the wave
for (i=(ampl-1);i>=1;i--) {
for (j=1;j<=i;j++)
cout << i;
cout << endl;
}
if (k!=freq) cout << endl;
}
if (l!=numrep) cout << endl;
}
return 0;

}
[/cpp]

the LA-Z-BOy
Learning poster
Posts: 94
Joined: Wed Jul 31, 2002 12:44 pm
Contact:
well, don't bother much about p.e. as the OJ clearly says
The 24-hours judge takes it only as a warning. Don't worry a lot, since many of our problems have the output specification not very fine.
it is the case for p488 as well. output a blank line at the end of all the output sets and you'll overcome p.e. that is just change your code...
from...
Istiaque Ahmed [the LA-Z-BOy]

danielrocha
New poster
Posts: 44
Joined: Sun Apr 27, 2003 3:17 am
Location: Rio Grande do Norte - Brazil
Contact:
Ok, thanks! Your tip didn't actually solve my problem (even with the modifications you said I'm still getting P.E.), but if the OJ tells me not to worry a lot...
I've heard that in real contests a P.E. is not considered an Accept. Is that true?

Thanks, greets from Brazil Daniel

the LA-Z-BOy
Learning poster
Posts: 94
Joined: Wed Jul 31, 2002 12:44 pm
Contact:
strange!!!!
i just have to ask you a question... did you submit the problem's solution (with modifation i said, off course) to any other judge than UVA Online Judge? ps. i don't know about ``real contests'', but i can tell you about uva public contests where the judge takes presentation error as wrong answer (i.e not accepted).
Istiaque Ahmed [the LA-Z-BOy]

kate
New poster
Posts: 11
Joined: Thu May 22, 2003 9:37 pm

### 488 WA , no idea

I'm getting a wrong answer and I have no idea why. I know it's multiple output and my answers look fine when I try them. Any ideas?

Code: Select all

``````#include <iostream>
using namespace std;

void line(int number)
{
int times = 0;
do {
cout << number;
times++;
} while (times<number);
}

int main()
{
int amp, freq;
int count = 0, i = 0, j = 0, k = 0;
int cases;

cin >> cases;
do {
cin >> amp >> freq;
if(amp==1) {
do {
cout << 1 << endl;
j++;
if(j<freq)
cout << endl;
} while(j<freq);
}
else if(amp==0) {
do {
k++;
if(k<freq)
cout << endl;
} while(k<freq);
}
else {
do {
int number = 1;
do {
line(number);
cout << endl;
number++;
} while (number<=amp);
number=amp-1;
do {
line(number);
cout << endl;
number--;
} while (number>=1);
count++;
if (count<freq)
cout << endl;
} while (count<freq);
}
i++;
count = 0;
if(i<cases)
cout << endl;
}while(i<cases);
return 0;
}``````

Tanzim-Saqib
New poster
Posts: 10
Joined: Thu Jun 05, 2003 5:23 pm
Contact:
NOTE: There is a blank line after each separate waveform, excluding the last one.
Read the problem statement carefully, and I hope you can solve this very easy problem.
[Tanzim Saqib]
-----------------------------
Problemsetter of 10490
Website: http://tanzim.tk

Dominik Michniewski
Guru
Posts: 834
Joined: Wed May 29, 2002 4:11 pm
Location: Wroclaw, Poland
Contact:
Multiply input ?

DM
If you really want to get Accepted, try to think about possible, and after that - about impossible ... and you'll get, what you want ....
Born from ashes - restarting counter of problems (800+ solved problems)

Dominik Michniewski
Guru
Posts: 834
Joined: Wed May 29, 2002 4:11 pm
Location: Wroclaw, Poland
Contact:
Multiply input is shown as blue checkmark near to problem title. And it does not have any correlation with this, what is written in problem description.

DM

PS. Send me private message with proper code
If you really want to get Accepted, try to think about possible, and after that - about impossible ... and you'll get, what you want ....
Born from ashes - restarting counter of problems (800+ solved problems)

Experienced poster
Posts: 131
Joined: Thu Aug 14, 2003 10:23 pm
Location: BUET
Contact:

### 488 prob,plizzzzzzzzzz help

bosssssssss i am in trouble , i dont understand these following line:

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

here is my code . pliz help me bossssssssssss.

[c]

Code: Select all

``````
#include<stdio.h>

int main(){

register int i , j ,k;
int a,f,count=0,check=0;

while(scanf("%d %d",&a,&f)==2){

if(check!=0){
printf("\n");
}
for(i=0,count=0;i<f;i++,count++){

for(j=1;j<=a;j++){
for(k=0;k<j;k++){

printf("%d",j);
}
printf("\n");

}

for(j=a-1;j>=1;j--){
for(k=0;k<j;k++){

printf("%d",j);
}
printf("\n");
}
if(count!=f-1){
printf("\n");
}

}

check++;

}

return 0;
}

[b][i][u]

[/c]
HOLD ME NOW ,, I AM 6 FEET FROM THE EDGE AND I AM THINKIN.. MAY BE SIX FEET IS SO FAR DOWN

LittleJohn
Learning poster
Posts: 83
Joined: Wed Feb 27, 2002 2:00 am
Location: Taiwan
It's a multipla-input problem (blue checkmark).
http://acm.uva.es/problemset/minput.html Riyad  