Page 16 of 19
Re: 488-Triangle Wave
Posted: Thu Aug 16, 2012 12:45 pm
by wangluofan
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
by brianfry713
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
by wangluofan
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
by Sabiha_Fancy
I am getting wrong answere each time i submit it. I can't find the error.
Please help me
#include<stdio.h>
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
by brianfry713
Don't print a blank line at the beginning of the output.
Re: please help me why i am getting WA for my code ?
Posted: Thu Sep 27, 2012 4:27 pm
by atul
Please help me ,,Getting wrong ans..problem no. 488 ..Triangle wave
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;
}
Re: please help me why i am getting WA for my code ?
Posted: Thu Sep 27, 2012 10:52 pm
by brianfry713
NOTE: There is a blank line after each separate waveform, excluding the last one.
Re: please help me why i am getting WA for my code ?
Posted: Sat Sep 29, 2012 11:20 am
by atul
I got AC...
Re: please help me why i am getting WA for my code ?
Posted: Sat Sep 29, 2012 11:48 am
by atul
Now it is AC..
I forgor to print newline...

488(WA) help me..
Posted: Wed Nov 14, 2012 11:28 am
by bimajw
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
by brianfry713
Don't double post.
Re: 488(WA) help me..
Posted: Thu Nov 15, 2012 12:26 pm
by bimajw
sorry I will not repeat again
Re: 488 - Triangle Wave
Posted: Sat Dec 08, 2012 9:10 am
by Sabiha_Fancy
Thank you for your reply
488 WA
Posted: Sun Jan 13, 2013 3:00 pm
by hansyulian
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
by brianfry713