.


- 2


begin

k := 0;

repeat

k := k + 1;

n := n div 10

until n = 0

end;

. , m , - , - , ... c- (9, 90, 900, ..., 9...0).

c

- , z , s n- .

: m := 9; z := 0; s := 0, number(n, c) c:

m := 9; number(n, c); z := 0; s := 0;

, 1 c - 1. i.

 

for i := 1 to c - 1 do

begin

z := z + m*i; { }

s := s + m;

m := m*10

end;

(z := z + m*i), , .. .

, z c- :

z := z + (n - s)

c {n - s c-}

{}

 

 

Procedure Page(n : integer; var

z : integer);

var

i, m, c, s : integer;

begin

m := 9;

number(n, c); z := 0; s := 0;

for i := 1 to c - 1 do

begin

z := z + m*i; { }

s := s + m;

m := m*10

end;

z := z + (n - s)*c

end;

, ,

Program

Problem7; { }

uses WinCrt;

var

n, c : integer;

{----------------------------------------------------------------------------------------}

Procedure number(n : integer; var k : integer);

begin