记录编号 19783 评测结果 AAAAAAAAAA
题目名称 排序工作量-加强版 最终得分 100
用户昵称 Gravatar苏轼 是否通过 通过
代码语言 Pascal 运行时间 0.282 s
提交时间 2010-10-18 08:46:42 内存使用 11.56 MiB
显示代码纯文本
program px(input,output);

var
  i,j,n,num,ans:longint;
  fl:array[-1..10,-1..10,-1..10,-1..10,-1..10,-1..10]of longint;

begin
  assign(input,'px.in');
  reset(input);

  assign(output,'px.out');
  rewrite(output);

  readln(n);

  for i:=1 to n do
  begin
    readln(num);
    num:=100000-num;

    inc(fl[num div 100000,-1,-1,-1,-1,-1]);
    inc(fl[num div 100000,num div 10000 mod 10,-1,-1,-1,-1]);
    inc(fl[num div 100000,num div 10000 mod 10,num div 1000 mod 10,-1,-1,-1]);
    inc(fl[num div 100000,num div 10000 mod 10,num div 1000 mod 10,num div 100 mod 10,-1,-1]);
    inc(fl[num div 100000,num div 10000 mod 10,num div 1000 mod 10,num div 100 mod 10,num div 10 mod 10,-1]);
    inc(fl[num div 100000,num div 10000 mod 10,num div 1000 mod 10,num div 100 mod 10,num div 10 mod 10,num mod 10]);

    for j:=0 to num div 100000-1 do
      ans:=ans+fl[j,-1,-1,-1,-1,-1];

    for j:=0 to num div 10000 mod 10-1 do
      ans:=ans+fl[num div 100000,j,-1,-1,-1,-1];

    for j:=0 to num div 1000 mod 10-1 do
      ans:=ans+fl[num div 100000,num div 10000 mod 10,j,-1,-1,-1];

    for j:=0 to num div 100 mod 10-1 do
      ans:=ans+fl[num div 100000,num div 10000 mod 10,num div 1000 mod 10,j,-1,-1];

    for j:=0 to num div 10 mod 10-1 do
      ans:=ans+fl[num div 100000,num div 10000 mod 10,num div 1000 mod 10,num div 100 mod 10,j,-1];

    for j:=0 to num mod 10-1 do
      ans:=ans+fl[num div 100000,num div 10000 mod 10,num div 1000 mod 10,num div 100 mod 10,num div 10 mod 10,j];
  end;

  writeln(ans);

  close(input);
  close(output);
end.