uses crt; var l,i,n,den,mes,dmax:byte; s,god,k:integer; begin clrscr; {$I-} write(' Vvedite den '); readln(den); write(' Vvedite mes '); read(mes); write(' Vvedite god '); read(god); case mes of 1,3,5,7,8,10,12: dmax:=31; 4,6,9,11: dmax:=30; 2: if (god mod 4=0) and not((god mod 100=0) and (god mod 400<>0)) then dmax:=29 else dmax:=28; else; end; if (den in[1..dmax]) and (mes in[1..12]) and (god>0) or (ioresult<>0) then writeln(' Data OK') else begin writeln(' Data NO'); readkey; halt end; write(' Vvedite k '); read(k); if k<0 then begin writeln('OSHIBKA'); readkey; halt end else; s:=0; for i:=1 to mes-1 do begin case i of 1,3,5,7,8,10,12: dmax:=31; 4,6,9,11: dmax:=30; 2: if (god mod 4=0) and not((god mod 100=0) and (god mod 400<>0)) then dmax:=29 else dmax:=28 else; end; s:=s+dmax; end; s:=s+den-k; l:=1; if s<=0 then repeat begin dec(god); {if (god mod 4<>0) and (l mod 4=1) then s:=s+365-1 else} if (god mod 4=0) and not((god mod 100=0) and (god mod 400<>0)) then s:=s+366 else s:=s+365; end; until s>0; writeln(' s= ',s); n:=1; {vivod} repeat case n of 1,3,5,7,8,10,12: dmax:=31; 4,6,9,11: dmax:=30; 2: if (god mod 4=0) and not((god mod 100=0) and (god mod 400<>0)) then dmax:=29 else dmax:=28; else; end; if s>dmax then begin inc(n); s:=s-dmax end; until s<=dmax; writeln(' ',s,':',n,':',god); readkey end.