CTNBULLS - Bulls and Cows
Tác giả: flashmt
Ngôn ngữ: Pascal
const fi='';
fo='';
m=2111992;
maxn=100100;
var n,k,i:longint;
a:array[1..maxn] of longint;
begin
assign(input,fi);
reset(input);
read(n,k);
close(input);
fillchar(a,sizeof(a),0);
a[1]:=2;
for i:=2 to n do
begin
if i-k-1>0 then a[i]:=(a[i-1]+a[i-k-1]) mod m
else a[i]:=(a[i-1]+1) mod m;
end;
assign(output,fo);
rewrite(output);
write(a[n]);
close(output);
end.