Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

各位大哥帮帮忙,看看为什么WA?

Posted by fengkdash at 2005-12-06 23:20:42 on Problem 1013
program ryh;
 var n,j,p,k,q:integer;
     a:array['A'..'L'] of integer;
     s,s1,s2:string;
     i:char;
begin
 readln(n);
 for q:=1 to n do
  begin
   for i:='A' to 'L' do a[i]:=2;
   for j:=1 to 3 do
    begin
     readln(s);
     p:=pos(' ',s);
     s1:=copy(s,1,p-1);
     s2:=copy(s,p+1,p-1);
     delete(s,1,2*p);
     if s='even' then
      for k:=1 to p-1 do
       begin
        a[s1[k]]:=0;
        a[s2[k]]:=0;
       end;
     if s='up' then
      for k:=1 to p-1 do
       begin
        if a[s1[k]]=-1 then a[s1[k]]:=0;
        if a[s1[k]]=2 then a[s1[k]]:=1;
        if a[s2[k]]=1 then a[s2[k]]:=0;
        if a[s2[k]]=2 then a[s2[k]]:=-1;
       end;
     if s='down' then
      for k:=1 to p-1 do
       begin
        if a[s1[k]]=1 then a[s1[k]]:=0;
        if a[s1[k]]=2 then a[s1[k]]:=-1;
        if a[s2[k]]=-1 then a[s2[k]]:=0;
        if a[s2[k]]=2 then a[s2[k]]:=1;
       end;
    end;
   for i:='A' to 'L' do
    begin
     if a[i]=1 then writeln(i,' is the counterfeit coin and it is heavy.');
     if a[i]=-1 then writeln(i,' is the counterfeit coin and it is light.');
    end;
  end;
end.

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator