- 集合删数
- 2017-07-03 22:19:20 @
var
K,M,s1,s2,e1,e2,p,s,i,tot:longint;
f,f1,f2:array[0..30001]of longint;
a:array[0..50]of 0..9;
procedure work(x:longint);
begin
if x=0 then exit
else work(x div 10);
x:=x mod 10;
inc(tot);
while (x>f[p]) and (tot-p<=M) do dec(p);
inc(p); f[p]:=x;
end;
begin
read(K,M);
s1:=1; s2:=1; e1:=0; e2:=0; p:=1;
f[1]:=1; s:=1; f[0]:=10; tot:=1;
write(s);
for i:=2 to k do
begin
inc(e1); f1[e1]:=2*s+1;
inc(e2); f2[e2]:=4*s+5;
if f1[s1]<f2[s2] then
begin s:=f1[s1]; inc(s1); end
else begin s:=f2[s2]; inc(s2); end;
write(s);
work(s);
end;
writeln;
for i:=1 to p do
write(f[i]);
end.
2 条评论
-
Hzh123 LV 7 @ 2017-07-04 10:27:45
解决了 f数组开小了
-
2017-07-03 22:19:48@
求大神帮忙
- 1