488 - Triangle Wave
Moderator: Board moderators
-
- 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?
Please read http://acm.uva.es/problemset/minput.html
Please read http://acm.uva.es/problemset/minput.html
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",&,&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;
}
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",&,&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.
shatl.
Wrong Answer
I keep receiving wrong answer....
I sent in 5 times....
By the way, the question did not say that it is a multiple input problem.
I sent in 5 times....
By the way, the question did not say that it is a multiple input problem.
Please help with 488
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;
}
#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;
}
this problem has multiple input (with blue flag)
http://acm.uva.es/problemset/minput.html
http://acm.uva.es/problemset/minput.html
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?
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?
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.
The format of multiple input question can be referred as http://acm.uva.es/problemset/minput.html, as Picard said.
488: Please help me out from this WA
Program is in C..please help me..it always gets WA..
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");
}
}
}
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");
}
}
}
why WA again and again?
![:cry:](./images/smilies/icon_cry.gif)
![:cry:](./images/smilies/icon_cry.gif)
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.