結果

問題 No.171 スワップ文字列(Med)
ユーザー te-sh
提出日時 2016-09-07 17:09:21
言語 D
(dmd 2.109.1)
結果
WA  
実行時間 -
コード長 639 bytes
コンパイル時間 745 ms
コンパイル使用メモリ 126,884 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-12 04:13:23
合計ジャッジ時間 1,356 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 5 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.algorithm, std.array, std.container, std.range, std.bitmanip;
import std.numeric, std.math, std.bigint, std.random, core.bitop;
import std.string, std.regex, std.conv, std.stdio, std.typecons;

const auto mod = 573;

void main()
{
  auto s = readln.chomp.map!(to!int).array;
  s.sort();
  auto gi = s.group.map!("a[1]").filter!("a > 1").array;

  auto ti = iota(1, s.length + 1).array;
  foreach (g; gi) {
    foreach (h; 1..g + 1) {
      foreach (ref t; ti) {
        if (t % h == 0) {
          t /= h;
          break;
        }
      }
    }
  }

  auto r = 1;
  foreach (t; ti)
    r = (r * t) % mod;

  writeln(r - 1);
}
0