Pagini recente » Cod sursa (job #872282) | Cod sursa (job #470155) | Cod sursa (job #3138550) | Cod sursa (job #42554) | Cod sursa (job #602822)
Cod sursa(job #602822)
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.