uses crt; var l,i,n,den,mes,dmax:byte; s,god,k:integer; f:string; i1,i2,i3:boolean; begin clrscr; {$I-} write(' Vvedite den: '); readln(den); i1:=ioresult=0; write(' Vvedite mes: '); read(mes); i2:=ioresult=0; write(' Vvedite god: '); read(god); i3:=ioresult=0; 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 i1 and i2 and i3 then writeln(' Data pravilnaya') else begin writeln(' Data NE pravilnay'); readkey; halt end; write(' Vvedite k - kolicestvo dney: '); read(k); if k<0 then begin writeln('OSHIBKA! chislo doljno bit bolshe nolya'); readkey; halt end else; s:=0; for i:=1 to abs(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<0 then f:=' do nashey eri' else f:=''; 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; n:=1; 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; 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 s:=s-dmax; inc(n) end; if god<0 then god:=-god; writeln(' novaya data: ',s,':',n,':',god,f); readkey end.