|
|
вернуться в форумWa 8 var i,j,k,n,d,l:longint; st:string; s:array [1..100] of string; a:array [1..100] of integer; begin readln (n); if n=0 then writeln ('10'); k:=0; st:=''; for j:=1 to n do begin readln (k,st); a[j]:=k; s[j]:=st; end; for l:=1 to n-1 do for i:=1 to n-l do begin if a[i]<a[i+1] then begin k:=a[i]; a[i]:=a[i+1]; a[i+1]:=k; st:=s[i]; s[i]:=s[i+1]; s[i+1]:=st; end; end; i:=1; if s[1]=' satisfied' then begin while s[i]=' satisfied' do begin i:=i+1; k:=a[i-1]; end; writeln (k); end; d:=1; if s[1]=' hungry' then begin for i:=2 to n do begin if s[1]=s[i] then inc(d); end; if d= n then writeln ('10') else writeln ('Inconsistent'); end; end. can you give some tests? Edited by author 20.01.2009 14:17 Re: Wa 8 Послано LeBron 20 июл 2009 19:13 try this: 2 5 hungry 5 satisfied (answer is "Inconsistent") Re: Wa 8 Thanks that helped me. Re: Wa 8 Thanks a lot brother.... |
|
|