ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1644. A Whole Lot of Walnuts

Wa 8
Posted by Zharenkov_ssau 20 Jan 2009 14:17
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
Posted by LeBron 20 Jul 2009 19:13
try this:
2
5 hungry
5 satisfied
(answer is "Inconsistent")
Re: Wa 8
Posted by amirani 15 Jan 2012 18:42
Thanks that helped me.
Re: Wa 8
Posted by Ealham Al Musabbir 13 Jun 2015 01:34
Thanks a lot brother....