Cod sursa(job #602822)
| Utilizator | Data | 13 iulie 2011 12:50:58 | |
|---|---|---|---|
| Problema | Jocul Flip | Scor | 0 |
| Compilator | fpc | Status | done |
| Runda | Arhiva de probleme | Marime | 0.45 kb |
program jocul_Flip;
var
n,m:byte;
temp,s,countn,countm:longint;
f,g:text;
begin
assign(f,'flip.in');
assign(g,'flip.out');
reset(f);
read(f,m);
read(f,n);
countm:=0;
repeat
countn:=0;
countm:=countm+1;
if countm<=m then
repeat
read(f,temp);
countn:=countn+1;
if countn>n then
temp:=0;
if temp>0 then
s:=s+temp;
until eoln(f);
until (eof(f)) or (countm>m);
close(f);
rewrite(g);
write(g,s);
close(g);
end.