488 - Triangle Wave

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

Moderator: Board moderators

Adrian Kuegel
Guru
Posts: 724
Joined: Wed Dec 19, 2001 2:00 am
Location: Germany

Post by Adrian Kuegel » Sat Aug 10, 2002 11:22 am

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!

Post by liusu » Sat Aug 10, 2002 12:38 pm

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
Location: Bangladesh

Post by Noim » Mon Oct 14, 2002 8:14 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

Post by FlyDeath » Wed Dec 18, 2002 3:07 pm

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.

User avatar
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.

Post by danielrocha » Tue Apr 29, 2003 3:24 am

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 8)

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]

User avatar
the LA-Z-BOy
Learning poster
Posts: 94
Joined: Wed Jul 31, 2002 12:44 pm
Location: Dacca, Bangladesh
Contact:

Post by the LA-Z-BOy » Wed Apr 30, 2003 6:40 am

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]

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

Post by danielrocha » Thu May 01, 2003 1:47 am

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 8)

Daniel

User avatar
the LA-Z-BOy
Learning poster
Posts: 94
Joined: Wed Jul 31, 2002 12:44 pm
Location: Dacca, Bangladesh
Contact:

Post by the LA-Z-BOy » Thu May 01, 2003 11:16 am

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? :wink:

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

Post by kate » Sun May 25, 2003 11:38 pm

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
Location: CS, AIUB, Dhaka, Bangladesh
Contact:

Post by Tanzim-Saqib » Fri Jun 06, 2003 6:14 pm

I think you have not got the answer yet. So I am trying to help you.
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:

Post by Dominik Michniewski » Thu Jun 12, 2003 7:52 am

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:

Post by Dominik Michniewski » Fri Jun 13, 2003 7:45 am

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
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)

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

488 prob,plizzzzzzzzzz help

Post by Riyad » Sat Aug 16, 2003 5:16 am


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]
[/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

Post by LittleJohn » Sat Aug 16, 2003 5:36 am

It's a multipla-input problem (blue checkmark).
http://acm.uva.es/problemset/minput.html 8)

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

488, got ac

Post by Riyad » Sat Aug 16, 2003 4:30 pm

thanx buddy for u r help little john . for a new person like me it s a great help.
Riyad :P :D
HOLD ME NOW ,, I AM 6 FEET FROM THE EDGE AND I AM THINKIN.. MAY BE SIX FEET IS SO FAR DOWN

Post Reply

Return to “Volume 4 (400-499)”