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.
Thank you!
Thank you very much! now,with your few words,i understand the prblem..
thanks again!
thanks again!
Please put your code like this.It is easier to read.Thanks.
[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.
[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.
-
- 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",&l,&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]
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",&l,&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]
-
- Learning poster
- Posts: 94
- Joined: Wed Jul 31, 2002 12:44 pm
- Location: Dacca, Bangladesh
- Contact:
well, don't bother much about p.e. as the OJ clearly says
from...
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...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.
from...
Code: Select all
Istiaque Ahmed [the LA-Z-BOy]
-
- New poster
- Posts: 44
- Joined: Sun Apr 27, 2003 3:17 am
- Location: Rio Grande do Norte - Brazil
- Contact:
-
- Learning poster
- Posts: 94
- Joined: Wed Jul 31, 2002 12:44 pm
- Location: Dacca, Bangladesh
- 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).
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]
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;
}
-
- New poster
- Posts: 10
- Joined: Thu Jun 05, 2003 5:23 pm
- Location: CS, AIUB, Dhaka, Bangladesh
- Contact:
-
- Guru
- Posts: 834
- Joined: Wed May 29, 2002 4:11 pm
- Location: Wroclaw, Poland
- Contact:
-
- 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.
Best regrads
DM
PS. Send me private message
with proper code
Best regrads
DM
PS. Send me private message

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)
Born from ashes - restarting counter of problems (800+ solved problems)
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]
thanx in advance[/u][/i][/b]
HOLD ME NOW ,, I AM 6 FEET FROM THE EDGE AND I AM THINKIN.. MAY BE SIX FEET IS SO FAR DOWN
-
- Learning poster
- Posts: 83
- Joined: Wed Feb 27, 2002 2:00 am
- Location: Taiwan
488, got ac
thanx buddy for u r help little john . for a new person like me it s a great help.
Riyad

Riyad


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