Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
为什么总是runtime errorprogram pku1013; var n,i,j,k:integer; a:array[1..12]of integer; st:array[1..3]of string; s:string; b:boolean; begin readln(n); for i:=1 to n do begin fillchar(a,sizeof(a),0); for j:=1 to 3 do begin readln(st[j]); if st[j][11]='e' then begin for k:=1 to 9 do if st[j][k]<>' ' then a[ord(st[j][k])-64]:=2; end; end; for j:=1 to 3 do begin for k:=1 to 4 do begin if (st[j][11]='u')and(a[ord(st[j][k])-64]=0) then a[ord(st[j][k])-64]:=1; if (st[j][11]='d')and(a[ord(st[j][k])-64]=0) then a[ord(st[j][k])-64]:=-1; end; for k:=6 to 9 do begin if (st[j][11]='u')and(a[ord(st[j][k])-64]=0) then a[ord(st[j][k])-64]:=-1; if (st[j][11]='d')and(a[ord(st[j][k])-64]=0) then a[ord(st[j][k])-64]:=1; end; end; for j:=1 to 12 do begin b:=false; if a[j]=1 then begin b:=true; for k:=1 to 3 do begin if ((st[k][11]='u')and((pos(chr(j+64),st[k])=0) or(pos(chr(j+64),st[k])>5))) or ((st[k][11]='d')and((pos(chr(j+64),st[k])=0) or(pos(chr(j+64),st[k])<5))) then begin b:=false; break; end; end; end; if a[j]=-1 then begin b:=true; for k:=1 to 3 do begin if ((st[k][11]='u')and((pos(chr(j+64),st[k])=0) or(pos(chr(j+64),st[k])<5))) or ((st[k][11]='d')and((pos(chr(j+64),st[k])=0) or(pos(chr(j+64),st[k])>5))) then begin b:=false; break; end; end; end; if b then begin write(chr(j+64),' is the counterfeit coin and it is '); if a[j]=1 then writeln('heavy.') else writeln('light.'); break; end; end; end; end. Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator