Page 3 of 19

Posted: Sun Aug 24, 2003 3:58 am
by Iwashere
Can anyone help me with my code. I tried it and it looked alright, but i got WA :cry:

Code: Select all

#include <stdio.h>

int amp, fre, no, i, l;

int main(){
scanf ("%d",&no);
for (; no>0; no--){
	scanf("%d %d",&amp,&fre);
	for (; fre>0; fre--){
		for (i=1; i<=amp; i++){
			for (l=i; l>0; l--){
				printf("%d",i);
			}
			printf("\n");
		}
		for (i=amp-1; i>1; i--){
			for (l=i; l>0; l--){
				printf("%d",i);
			}
			printf("\n");
		}
		if ((no==1)&&(l==0)&&(fre==1)){
			printf("1");
		}
		else{
			printf("1\n\n");
		}
	}
}
return 0;
}

Posted: Mon Aug 25, 2003 9:37 am
by Joseph Kurniawan
Just change the part
[c]
}
for (i=amp-1; i>1; i--){
for (l=i; l>0; l--){
printf("%d",i);
}
printf("\n");
}
[/c]

with
[c]
}
for (i=amp-1; i>=1; i--){
for (l=i; l>0; l--){
printf("%d",i);
}
printf("\n");
}
printf("\n");
[/c]

And remove the part
[c]
if ((no==1)&&(l==0)&&(fre==1)){
printf("1");
}
else{
printf("1\n\n");
}
[/c]

And after the part
[c]
scanf("%d",&no);
[/c]
put
[c]
if(k) printf("\n\n");
else k=1;
[/c]
So you have to add one more variable.
Good Luck!!

Posted: Mon Aug 25, 2003 11:05 am
by Iwashere
Hey, I got AC, thanks for your help!

488 WA please help me

Posted: Fri Oct 03, 2003 7:00 am
by claire yan
i got WA and WA but i tried and tried
please please help me!!!!![cpp]
#include <iostream>
#include <stdio.h>
using namespace std;
////////////////////////////


int main()
{
int i = 0;
int j = 0;
int k = 0;
int m = 0;
int temp;
int amp[15000];
int fre[15000];
while(cin>>amp>>fre)
i = i+1;
temp = i--;
for(i = 0; i < temp; i++)
{
for(j = 0; j < fre; j++)
{
for(k=1;k <= amp;k++)
{
for(m = 1;m <= k ; m++)
cout<< k;
cout<<endl;
}
for(k = amp-1;k >= 1; k--)
{
for(m = 1;m <=k ; m++)
cout<<k;
cout<<endl;
}
cout<<endl;
}
cout<<endl;
}
return 0;
}[/cpp]

Posted: Fri Oct 03, 2003 2:02 pm
by Subeen
the problem is a multiple input problem ( blue tick ) u must consider this.

Posted: Fri Oct 03, 2003 6:56 pm
by claire yan
thanks a lot
i have already got AC
^^

488-WA I know that's multiple input

Posted: Sat Oct 04, 2003 6:02 pm
by Admus
I don' know what is wrong with it

Code: Select all

const
  tab:array[1..9] of string=
  ('1','22','333','4444','55555','666666','7777777','88888888','999999999');
var
  a,i,q,n,m,j:longint;
begin
  while not eof do
  begin
  readln(n);
  readln(m);
  if n>0 then
  for i:=1 to m do
    begin
      for j:=1 to n do
        writeln(tab[j]);
        for j:=n-1 downto 1 do
           writeln(tab[j]);
        if i<>m then
          writeln;
    end;
  end;
end.

488....Why WA?

Posted: Tue Apr 13, 2004 4:30 am
by midra
Here is my code:

[c][/c]

I can't see what is wrong with it!
if someone knows...pleas help me

Posted: Tue Apr 13, 2004 5:41 am
by shamim
This is a blue tick problem.
That is the first line of input is the number of test cases, eventhough this is not shown in the sample input. :wink:

Posted: Wed Apr 14, 2004 4:52 am
by midra
Thank you Shamin!
I finally got AC! :D :D :D

good bye!!!!

488 WA odd...

Posted: Thu Nov 18, 2004 5:46 pm
by randomtaiwanese
[java]import java.io.IOException;
import java.util.StringTokenizer;

class Main
{
static String ReadLn()
{
byte lin[]=new byte[25];
int lg=0,car;
try
{
while(true)
{
car=System.in.read();
if ((car<0)||(car=='\n'))
break;
lin[lg++]+=car;
}
}
catch(IOException e)
{
return(null);
}
if ((car<0)&&(lg==0))
return(null);
return (new String (lin, 0, lg));
}
public static void main(String[] args)
{
Main newMain = new Main();
newMain.start();
}
void start()
{
int[][] in = new int[10000][2];
int c = 0;
int max = 0;
boolean inb = true;
String input;
while ((input=Main.ReadLn())!=null)
{
if(max==0)
max = Integer.parseInt(new StringTokenizer(input).nextToken());
else if(inb)
{
in[c][0] = Integer.parseInt(new StringTokenizer(input).nextToken());
inb = false;
}
else
{
in[c][1] = Integer.parseInt(new StringTokenizer(input).nextToken());
c++;
inb = true;
}
if(c==max)
{
for(int i=0;i<max;i++)
for(int f=0;f<in[1];f++)
{
for(int a=1;a<in[0];a++)
{
for(int t=1;t<=a;t++)
System.out.print(a);
System.out.println();
}
for(int a=in[0];a>0;a--)
{
for(int t=a;t>=1;t--)
System.out.print(a);
System.out.println();
}
if(f!=in[1]-1)
System.out.println();
}
break;
}
}
}
}[/java]

can someone please help me

Posted: Thu Nov 18, 2004 6:44 pm
by Mohammad Mahmudur Rahman
Hmm, I didn't completely see your code, just a glance... It seems that you've not handled the multiple input case. Note that if u have an earlier version of problemset, the problem was marked as a blue flag problem there.

488 why WA???

Posted: Mon Jan 31, 2005 8:20 pm
by Fuad Hassan_IIUC(DC)
plz help me out.

#include<stdio.h>
#include<iostream.h>
int main()
{
int a,f,i,j,k,l,m,flag;
cin>>a>>f;

flag=0;
for(i=1;i<=f;i++)
{
if(flag==1)
cout<<"\n";
for(j=1;j<=a;j++)
{
for(k=1;k<=j;k++)
cout<<j;
cout<<"\n";
}
for(l=a-1;l>=1;l--)
{
for(m=1;m<=l;m++)
cout<<l;
cout<<"\n";
}
flag=1;
}

return 0;
}

Posted: Thu Feb 03, 2005 4:14 pm
by emotional blind
this is a multiple input problem
consider about it
did you not see the blue tick in this problem

Posted: Thu Feb 03, 2005 6:01 pm
by Fuad Hassan_IIUC(DC)
thank you. i got AC . actually it was my foolish mistake :D