| ||||||||||
| 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 | |||||||||
怎么死WA?program pku1677;
const
mn =30;
mt =200;
var
n,m,i,top :longint;
nice,all :boolean;
nam :array[1..mn]of string;
wod :array[1..mt]of string;
procedure init;
var
sen:string;
i:longint;
begin
top:=1;
readln(sen);
wod[top]:='';
for i:=1 to length(sen) do
case sen[i] of
'a'..'z':wod[top]:=wod[top]+sen[i];
'A'..'Z':wod[top]:=wod[top]+chr(ord(sen[i])-32);
else if wod[top]<>'' then begin
inc(top);
wod[top]:='';
end;
end;
if wod[top]='' then dec(top);
end;
procedure main;
var
i,j,hw:longint;
met:array[1..50]of boolean;
begin
nice:=false; all:=false;
fillchar(met,sizeof(met),0);
for i:=1 to top do begin
if (wod[i]='beautiful') or (wod[i]='pretty')
or (wod[i]='lovely') then nice:=true;
if wod[i]='all' then all:=true;
if not all then
for j:=1 to n do
if nam[j]=wod[i] then met[j]:=true;
end;
if all then write('All')
else begin
hw:=0;
for i:=1 to n do
if met[i] then begin
inc(hw);
if hw>1 then write(' ');
write(nam[i]);
end;
end;
write(': ');
if top<10 then write('oh')
else
if nice then write('xixi')
else write('hehe');
writeln;
end;
begin
readln(n,m);
for i:=1 to n do readln(nam[i]);
for i:=1 to m do begin
init;
main;
end;
end.
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator