## 488 - Triangle Wave

Moderator: Board moderators

New poster
Posts: 4
Joined: Wed May 01, 2002 2:51 pm

### Q488

Hi, I wonder whats going wrong with this Que. I keep on getting WA.
i have tested e'thing n seems it gves me correct results......any suggestions....

Guru
Posts: 724
Joined: Wed Dec 19, 2001 2:00 am
Location: Germany
You haven't considered that the problem is in multiple input format, right?

shatl
New poster
Posts: 1
Joined: Sun Jun 02, 2002 7:21 pm
Location: Russia, South Ural

### problem 488

Hi all.
i have a question: subj - the last problem what i try to solve. there is a code. the my answers as look like a true (sample input and more another), but i recive only WA. i read article about multiple input, but not clearly understand it. please help me!
(i'm f student and this programm one of the component my term work)

#include <stdio.h>
#include <stdlib.h>

int i,j,freq,amp;

int main ()

{ while(!feof(stdin))
{
scanf("%d" "%d",&amp,&freq);
if(feof) break;
}

do
{ j=0;
for (j=0;j<=amp-1;j++)
for (i=1;i<=j+1;i++)
{
printf("%d",j+1); //output until amplitude
if (i==j+1)
printf("\n");
}
//output after amplitude
for (j;j>=1;j--)
for (i=1;i<=j-1;i++)
{
printf("%d",j-1);
if (i==j-1)
printf("\n");
}

printf("\n");

freq--;
} while (freq!=0);
return 0;
}
With best regards
shatl.

Ming Han
Learning poster
Posts: 77
Joined: Thu Jun 06, 2002 7:10 pm
Location: Singapore
Contact:

I sent in 5 times....

By the way, the question did not say that it is a multiple input problem.

Caesum
Experienced poster
Posts: 225
Joined: Fri May 03, 2002 12:14 am
Location: UK
Contact:
thats what the blue tick is for, and it does have a blue tick

10153EN
Experienced poster
Posts: 148
Joined: Sun Jan 06, 2002 2:00 am
Location: Hong Kong
Contact:
It has stated to be a multiple input problem~

Note the blue checkmark beside the problem number in the volume contents.

zakaria
New poster
Posts: 15
Joined: Thu Jun 27, 2002 11:34 pm

Can some one tell me why it is W.A??

#include<iostream.h>

int main()
{

unsigned long a,f;

while(cin>>a>>f)
{
if(a<=9)
{
for(unsigned long i=1;i<=f;i++)
{
unsigned long j;
for(j=1;j<=a;j++)
{
for(unsigned long k=1;k<=j;k++)
cout<<j;
cout<<"\n";
}
for(unsigned long l=j-2;l>=1;l--)
{
for(unsigned long k=1;k<=l;k++)
cout<<l;
cout<<"\n";
}
if(i!=f)cout<<"\n";
}
}
}
return 0;
}

Picard
Learning poster
Posts: 96
Joined: Mon Jun 24, 2002 1:22 pm
Location: Hungary
Contact:
this problem has multiple input (with blue flag)
http://acm.uva.es/problemset/minput.html

ec3_limz
Learning poster
Posts: 79
Joined: Thu May 23, 2002 3:30 pm
Location: Singapore

### What's with Multiple Input?

I myself have submitted the same problem over and over again. W. A. all the time.

Um, Picard, I do not actually see why it is wrong answer. The question did not say that then number of test cases will be more than one. Is there anything special about questions having multiple input?

10153EN
Experienced poster
Posts: 148
Joined: Sun Jan 06, 2002 2:00 am
Location: Hong Kong
Contact:
Did you note that the *tick mark* beside the problem number in the problems contents is blue in colour? It means the problem is of multiple input.

The format of multiple input question can be referred as http://acm.uva.es/problemset/minput.html, as Picard said.

zakaria
New poster
Posts: 15
Joined: Thu Jun 27, 2002 11:34 pm
Is'nt a multiple input program?
Kindly tell me about blue flag.

zakaria
New poster
Posts: 15
Joined: Thu Jun 27, 2002 11:34 pm
Yes it has accepted.
Thanks to all..

zakaria
New poster
Posts: 15
Joined: Thu Jun 27, 2002 11:34 pm
Take an extra input for case number though it is not
said to take in the problem.
Wish you good luck.

razibcse
New poster
Posts: 50
Joined: Mon Jul 22, 2002 3:17 am
Contact:

And what about the last line?

#include <stdio.h>

void main()
{
long a,f,b,i,j,k;
scanf("%ld\n%ld",&a,&f);
if(a<=9)
{
for(i=0;i<f;i++)
{
for(j=1;j<=a;j++)
{
b=j;
for(k=1;k<=b;k++)
printf("%ld",b);
printf("\n");
}
for(j=a-1;j>=1;j--)
{
b=j;
for(k=1;k<=b;k++)
printf("%ld",b);
printf("\n");
}
if(i!=(f-1))
printf("\n");
}
}

}

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

### why WA again and again?

my pascal can't meet the problem of multiple input..but i only get WA?
can you help me ?
thank u very.
Last edited by liusu on Sat Aug 10, 2002 5:31 pm, edited 1 time in total.