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

顶起 PASCAL!1

Posted by qiuwenhuah at 2012-08-25 10:22:45 on Problem 1250
var 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:
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