Cod sursa(job #378965)

Utilizator laurentiuuCindea Laurentiu Bogdan laurentiuu Data 30 decembrie 2009 03:15:11
Problema Bowling Scor 0
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.94 kb
program bowling;
var f,g:text;
    t,j:shortint;
    n,i,p:longint;
    v:array[1..50000] of integer;
begin
        assign(f,'bowling.in'); reset(f);
        assign(g,'bowling.out');        rewrite(g);
        read(f,t);
        for j:=1 to t do
        begin
        p:=0;
        read(f,n);
        for i:=1 to n do
        read(f,v[i]);
        i:=0;
        repeat
        i:=i+1;
        if v[i]<>0 then if i=n then p:=p+1
                                   else if v[i+1]<>0 then
                                                begin
                                                i:=i+1;
                                                p:=p+1;
                                                end
                                                else p:=p+1;
        until i=n;
        if p mod 2=0 then writeln(g,'Fumeanu')
                     else writeln(g,'Nargy');
        end;
        close(f);       close(g);
end.