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 |
1002题。。没想法了,大牛们谁帮忙找找错误WA在哪```program pku1002; const va=65; vy=89; vq=81; v0=48; v9=57; var n,i:longint; t:array[1..100000]of string; c:array[0..9,0..9,0..9,0..9,0..9,0..9,0..9]of integer; z1,z2,z3,z4,z5,z6,z7:integer; b:boolean; function e(c:char):integer; {字符->字母} begin if (c='A')or(c='B')or(c='C') then exit(2); if (c='D')or(c='E')or(c='F') then exit(3); if (c='G')or(c='H')or(c='I') then exit(4); if (c='J')or(c='K')or(c='L') then exit(5); if (c='M')or(c='N')or(c='O') then exit(6); if (c='P')or(c='R')or(c='S') then exit(7); if (c='T')or(c='U')or(c='V') then exit(8); if (c='W')or(c='X')or(c='Y') then exit(9); end; procedure d(s:string); {处理每个数据} var l:integer; j,k:integer; r:array[1..7]of integer; a:integer; begin l:=length(s); k:=0; for j:=1 to l do begin a:=ord(s[j]); if ((a>=va)and(a<=vy)and(a<>vq)) or ((a>=v0)and(a<=v9)) then {判断是否合法 a-z除了q 或者数字} begin k:=k+1; if (a>=va) and (a<=vy) then r[k]:=e(s[j]) else r[k]:=a-v0; end; end; c[r[1],r[2],r[3],r[4],r[5],r[6],r[7]]:=c[r[1],r[2],r[3],r[4],r[5],r[6],r[7]]+1; end; begin readln(n); for i:=1 to n do begin readln(t[i]); end; for z1:=0 to 9 do {数据清零} begin for z2:=0 to 9 do begin for z3:=0 to 9 do begin for z4:=0 to 9 do begin for z5:=0 to 9 do begin for z6:=0 to 9 do begin for z7:=0 to 9 do begin c[z1,z2,z3,z4,z5,z6,z7]:=0; end; end; end; end; end; end; end; for i:=1 to n do {数据处理} begin d(t[i]); end; b:=false; for z1:=0 to 9 do {数据输出} begin for z2:=0 to 9 do begin for z3:=0 to 9 do begin for z4:=0 to 9 do begin for z5:=0 to 9 do begin for z6:=0 to 9 do begin for z7:=0 to 9 do begin if c[z1,z2,z3,z4,z5,z6,z7]>=2 then begin if b=true then writeln(); write(z1,z2,z3,'-',z4,z5,z6,z7,' ',c[z1,z2,z3,z4,z5,z6,z7]); b:=true; end; end; end; end; end; end; end; end; if b=false then write('No duplicates.'); readln(z1); end. 代码写的很菜,大家凑合看看,帮个忙啊 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator