|
|
вернуться в форумCE Anybody help me with my program I got CE but at my computer I can Compile it easily Here is my solution: 1496.pas var a,a2:array[1..100]of string[30]; s:string; n,i,j,p,k,ans,m:integer; begin readln(n); m:=n; for i:=1 to n do begin readln(s); a[i]:=s; end; for i:=1 to n do a2[i]:=a[i]; for i:=1 to m do begin for j:=1 to m do begin if (i<>j)and(a2[i]=a2[j]) then begin p:=0; a2[j]:=''; for k:=j to m do begin a2[k]:=a2[k+1]; a2[k+1]:=''; end; dec(m); j:=0; end; end; end; for i:=1 to m do begin ans:=0; for j:=1 to n do if a[j]=a2[i] then inc(ans); if ans>1 then writeln(a2[i]); end; end. Exquse me for my bad English Edited by author 21.10.2006 22:29 Re: CE Don't use cycle's parametr inside cycle: for j:=1 to m do begin ... j:=0; ... end; Another Problem I have changed my code now it can't pass #7 test Can you say if input for example 4 and all "names" are different what must programm write in output?! P.S Ecuse me for my bad English. Edited by author 22.10.2006 12:17 Edited by author 22.10.2006 12:21 Re: Another Problem Послано mai7 27 окт 2006 16:47 Try to change string length to 31. I had WA on 7th, and after this took AC. |
|
|