|
|
back to boardWa test 1? I show the correct answer but tell me WA. why? Re: Wa test 1? I can tell you that it is very simple test but there some important things that must be forseen,so one of them is that when you write,for example, a,b:string; you must not read it like this readln(a,b); or read(a,b); you must write separately like this readln(a); readln(b); So I will write my program for you :) program amoc1446; var a,b:array[1..1000] of string[200]; i,n:integer; begin readln(n); for i:=1 to n do begin readln(a[i]); readln(b[i]); end; writeln('Slytherin:'); for i:=1 to n do if b[i]='Slytherin' then writeln(a[i]); writeln; writeln('Hufflepuff:'); for i:=1 to n do if b[i]='Hufflepuff' then writeln(a[i]); writeln; writeln('Gryffindor:'); for i:=1 to n do if b[i]='Gryffindor' then writeln(a[i]); writeln; writeln('Ravenclaw:'); for i:=1 to n do if b[i]='Ravenclaw' then writeln(a[i]);
end. Re: Wa test 1? I can tell you that it is very simple test but there are some important things that you must forseen,so one of them is that when you write,for example, a,b:string; you must not read it like this readln(a,b); or read(a,b); you must write separately like this readln(a); readln(b); So I will write my program for you :) program amoc1446; var a,b:array[1..1000] of string[200]; i,n:integer; begin readln(n); for i:=1 to n do begin readln(a[i]); readln(b[i]); end; writeln('Slytherin:'); for i:=1 to n do if b[i]='Slytherin' then writeln(a[i]); writeln; writeln('Hufflepuff:'); for i:=1 to n do if b[i]='Hufflepuff' then writeln(a[i]); writeln; writeln('Gryffindor:'); for i:=1 to n do if b[i]='Gryffindor' then writeln(a[i]); writeln; writeln('Ravenclaw:'); for i:=1 to n do if b[i]='Ravenclaw' then writeln(a[i]); end. I show the correct answer but tell me WA. why? |
|
|