Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program Project2;
- {$APPTYPE CONSOLE}
- uses
- SysUtils;
- var n,i,j,k,sum,sum2,x,l:integer;
- a,b:array[1..100000] of integer;
- c:array[1..6] of integer;
- begin
- reset(Input,'1.txt');
- rewrite(output,'2.txt');
- c[1]:=10; c[2]:=50;c[3]:=100;c[4]:=500;c[5]:=1000;c[6]:=5000;
- read(a[1],a[2],a[3],a[4],a[5],a[6],n);
- k:=0;
- sum:=10*a[1]+50*a[2]+100*a[3]+500*a[4]+1000*a[5]+5000*a[6];
- if a[1]<>0 then k:=1 else if a[2]<>0 then k:=2 else if a[3]<>0 then k:=3 else if a[4]<>0 then k:=4 else if a[5]<>0 then k:=5 else if a[6]<>0 then k:=6;
- sum2:=sum-c[k];
- i:=0;
- if k=0 then begin
- write(0);
- halt;
- end;
- while sum>sum2 do begin
- k:=sum div n;
- if k<>c[x] then begin
- inc(x);
- c[x]:=k;
- end;
- dec(sum,10);
- end;
- writeln(x);
- for i:=x downto 1 do begin
- if c[i]=0 then continue;
- write(c[i],' ');
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement