Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program Project1;
- const nmax=10;
- function tenstep(var n:byte):longint;
- var i:byte; a:longint;
- begin
- a := 1;
- for i := 1 to n do
- a := a * 10;
- tenstep:=a;
- end;
- var
- n:longint;
- a:array[1..nmax] of byte;
- i,j,g:byte;
- c:longint;
- begin
- writeln('input n');
- readln(n);
- if n<10 then writeln(n)
- else
- begin
- j:=0;
- c:=0;
- for i:=9 downto 2 do
- if n mod i=0 then
- repeat
- inc(j);
- a[j]:=i;
- n:=n div i;
- until n mod i<>0;
- inc(c,a[1]);
- for i:=2 to j do
- begin
- g:=i-1;
- inc(c,tenstep(g)*a[i]);
- end;
- writeln(c);
- end;
- readln;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement