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 |
顶起 PASCAL!1var n,l,i,sum,j,p:integer; f:boolean; s,st,ss:string; a:array[0..100] of boolean; begin readln(ss); p:=pos(' ',ss); val(copy(ss,1,p-1),n); st:=copy(ss,p+1,length(ss)); while n<>0 do begin fillchar(a,sizeof(a),true); l:=0; s:=''; for i:=1 to length(st) do begin f:=false; for j:=1 to l do if st[i]=s[j] then begin delete(s,j,1); l:=length(s); f:=true; break; end; if f then continue; if l<n then begin s:=s+st[i]; l:=length(s); end else a[ord(st[i])-64]:=false; end; sum:=0; for i:=1 to 26 do if not a[i] then inc(sum); if sum<>0 then writeln(sum,' customer(s) walked away.') else writeln('All customers tanned successfully.'); readln(ss); p:=pos(' ',ss); val(copy(ss,1,p-1),n); st:=copy(ss,p+1,length(ss)); end; end. Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator