记录编号 |
41130 |
评测结果 |
AAAAAAAAAAAATA |
题目名称 |
[暑假培训2012] 残酷的数学老师 |
最终得分 |
92 |
用户昵称 |
o_o |
是否通过 |
未通过 |
代码语言 |
Pascal |
运行时间 |
2.047 s |
提交时间 |
2012-07-20 17:38:57 |
内存使用 |
0.93 MiB |
显示代码纯文本
- var
- a,m,w,t:longint;
- i,j:longint;
- out:array[1..50000] of int64;
- sta:array[1..50000] of int64;
- procedure solve(n:longint);
- var
- z,u:longint;
- begin
- if n=0 then
- exit;
- solve(n div 2);
- w:=15000;
- while out[w]=0 do dec(w);
- for i:=1 to w do
- for j:=1 to w do
- if n mod 2=0
- then
- sta[i+j-1]:=sta[i+j-1]+out[i]*out[j]
- else
- sta[i+j-1]:=sta[i+j-1]+out[i]*out[j]*m;
- u:=15000;
- while (out[u]=0)and(sta[u]=0) do
- dec(u);
- for i:=1 to 15000 do
- begin
- out[i]:=sta[i] mod 10;
- sta[i+1]:=sta[i+1]+sta[i] div 10;
- end;
-
- fillchar(sta,sizeof(sta),0);
-
- end;
- begin
- assign(input,'cruel1.in');
- assign(output,'cruel1.out');
- reset(input);
- rewrite(output);
- read(m,a);
-
- out[1]:=1;
- solve(a);
- t:=0;
- for i:=15000 downto 1 do
- begin
- if (out[i]<>0)or(t=1) then
- begin
- t:=1;
- write(out[i]);
- w:=w+1;
- end;
- if (w mod 70=1)and(w<>1) then writeln;
- end;
- close(input);
- close(output);
- end.