比赛 |
20101105 |
评测结果 |
AAAAAAAAAA |
题目名称 |
Sramoc问题 |
最终得分 |
100 |
用户昵称 |
Achilles |
运行时间 |
0.000 s |
代码语言 |
Pascal |
内存使用 |
0.00 MiB |
提交时间 |
2010-11-05 20:13:40 |
显示代码纯文本
program sramoc;
var
f:array[0..1,0..1100]of boolean;
w,tm:array[0..1100]of string;
p:array[0..10]of longint;
aph:array[0..10]of string;
i,k,l,m,n,j,t:longint;
s:string;
begin
assign(input,'sramoc.in');
assign(output,'sramoc.out');
reset(input);
rewrite(output);
fillchar(f,sizeof(f),true);
readln(n,m);
for i:=0 to n do
begin
p[i]:=i mod m;
str(i,aph[i]);
end;
j:=10 mod m;
for i:=1 to n-1 do
begin
t:=p[i];
if (t=0) then begin
writeln(w[k]+aph[i]);
close(input);
close(output);
halt;
end;
if f[0,t] then
begin
w[t]:=w[k]+aph[i];
f[0,t]:=false;
end;
end;
repeat
for k:=1 to m-1 do
if not(f[0,k]) then
for i:=0 to n-1 do
begin
t:=(k*j+p[i])mod m;
if t=0 then begin
writeln(w[k]+aph[i]);
close(input);
close(output);
halt;
end
else if f[1,t] then
begin
tm[t]:=w[k]+aph[i];
f[1,t]:=false;
end;
end;
f[0]:=f[1];
fillchar(f[1],sizeof(f[1]),true);
for i:=1 to m-1 do if not(f[0,i]) then w[i]:=tm[i];
until n<0;
close(input);
close(output);
end.