记录编号 41130 评测结果 AAAAAAAAAAAATA
题目名称 [暑假培训2012] 残酷的数学老师 最终得分 92
用户昵称 Gravataro_o 是否通过 未通过
代码语言 Pascal 运行时间 2.047 s
提交时间 2012-07-20 17:38:57 内存使用 0.93 MiB
显示代码纯文本
  1. var
  2. a,m,w,t:longint;
  3. i,j:longint;
  4. out:array[1..50000] of int64;
  5. sta:array[1..50000] of int64;
  6. procedure solve(n:longint);
  7. var
  8. z,u:longint;
  9. begin
  10. if n=0 then
  11. exit;
  12. solve(n div 2);
  13. w:=15000;
  14. while out[w]=0 do dec(w);
  15. for i:=1 to w do
  16. for j:=1 to w do
  17. if n mod 2=0
  18. then
  19. sta[i+j-1]:=sta[i+j-1]+out[i]*out[j]
  20. else
  21. sta[i+j-1]:=sta[i+j-1]+out[i]*out[j]*m;
  22. u:=15000;
  23. while (out[u]=0)and(sta[u]=0) do
  24. dec(u);
  25. for i:=1 to 15000 do
  26. begin
  27. out[i]:=sta[i] mod 10;
  28. sta[i+1]:=sta[i+1]+sta[i] div 10;
  29. end;
  30.  
  31. fillchar(sta,sizeof(sta),0);
  32.  
  33. end;
  34. begin
  35. assign(input,'cruel1.in');
  36. assign(output,'cruel1.out');
  37. reset(input);
  38. rewrite(output);
  39. read(m,a);
  40.  
  41. out[1]:=1;
  42. solve(a);
  43. t:=0;
  44. for i:=15000 downto 1 do
  45. begin
  46. if (out[i]<>0)or(t=1) then
  47. begin
  48. t:=1;
  49. write(out[i]);
  50. w:=w+1;
  51. end;
  52. if (w mod 70=1)and(w<>1) then writeln;
  53. end;
  54. close(input);
  55. close(output);
  56. end.