Page 16 of 19

### Re: 488-Triangle Wave

Posted: Thu Aug 16, 2012 12:45 pm
I had submitted this for three times but it still wrong.I'm think there is an error where not discovered.

### Re: 488-Triangle Wave

Posted: Thu Aug 16, 2012 11:19 pm
If you copy and paste the code you've posted in this thread and submit it, the result is AC.

### Re: 488-Triangle Wave

Posted: Fri Aug 17, 2012 2:29 pm
Yes,But I had submitted once and got a wrong,but this time,the code hasn't been changed,this is very strange!!

### Re: 488 - Triangle Wave

Posted: Sat Sep 08, 2012 12:33 pm
I am getting wrong answere each time i submit it. I can't find the error.

int main()
{
int n,f,a,i,j,k,l,m;
scanf("%d",&n);
printf("\n");
for(i=0; i<n; ++i)
{
scanf("%d %d",&a,&f);
if(a==0 || f==0)
{
printf("0\n");
if(i<n-1)
printf("\n");
continue;
}
if(i>0)
printf("\n");
for(j=0; j<f; ++j)
{
m=1;
for(k=1; k<=(2*a-1); ++k)
{
if(k<=a)
{
for(l=1; l<=k; ++l)
{
printf("%d",k);
}
}
else
{
for(l=1; l<=k-(2*m); ++l)
{
printf("%d",k-(2*m));
}
m++;
}
printf("\n");
}
if(j<f-1)
printf("\n");
}
if(i<n-1)
printf("\n");
}
return 0;
}

### Re: 488 - Triangle Wave

Posted: Mon Sep 10, 2012 10:02 pm
Don't print a blank line at the beginning of the output.

Posted: Thu Sep 27, 2012 4:27 pm

here is my code

#include <iostream>

using namespace std;

int main()
{
int amp,fre,i,n,j,v,b;
cin>>n;
for(i=1;i<=n;i++)
{
cin>>amp>>fre;
for(j=1;j<=fre;j++)
{

for(int k=1;k<=amp;k++)
{

for(int l=1;l<=k;l++)
cout<<k;
cout<<"\n";

}
for(v=amp-1;v>=1;v--)
{

for(b=1;b<=v;b++)
cout<<v;
cout<<"\n";
}
cout<<"\n";

}
}

return 0;
}

Posted: Thu Sep 27, 2012 10:52 pm
NOTE: There is a blank line after each separate waveform, excluding the last one.

Posted: Sat Sep 29, 2012 11:20 am
I got AC...

Posted: Sat Sep 29, 2012 11:48 am
Now it is AC..
I forgor to print newline... ### 488(WA) help me..

Posted: Wed Nov 14, 2012 11:28 am
my code.
#include <iostream>
using namespace std;
int main(){
int T,A,f,i,j,k,l;
cin>>T;
cout<<"\n";
for(i=1;i<=T;i++){
cin>>A>>f;
if(A>9){break;}
if(A>0&&A<=9){
cout<<"\n";
for(j=1;j<=f;j++){
for(k=1;k<=A;k++){
for(l=1;l<=k;l++){
cout<<k;
}
cout<<"\n";
}
for(k=A-1;k>=1;k--){
for(l=1;l<=k;l++){
cout<<k;
}
cout<<"\n";
}
cout<<"\n";
}
}
}
}

### Re: 488(WA) help me..

Posted: Thu Nov 15, 2012 1:50 am
Don't double post.

### Re: 488(WA) help me..

Posted: Thu Nov 15, 2012 12:26 pm
sorry I will not repeat again

### Re: 488 - Triangle Wave

Posted: Sat Dec 08, 2012 9:10 am

### 488 WA

Posted: Sun Jan 13, 2013 3:00 pm
what is wrong with my code?

Code: Select all

``````#include <cstdio>

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

### Re: 488 WA

Posted: Sun Jan 13, 2013 8:31 pm
sample output

Code: Select all

``````1
22
333
22
1

1
22
333
22
1``````

Code: Select all

``````1
12
123
12
1

1
12
123
12
1``````