結果

問題 No.443 GCD of Permutation
ユーザー ​
提出日時 2016-11-12 19:30:26
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 293 bytes
コンパイル時間 261 ms
コンパイル使用メモリ 7,092 KB
実行使用メモリ 7,988 KB
最終ジャッジ日時 2023-08-17 03:49:30
合計ジャッジ時間 2,683 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 23 ms
7,648 KB
testcase_01 AC 23 ms
7,712 KB
testcase_02 AC 23 ms
7,740 KB
testcase_03 WA -
testcase_04 AC 24 ms
7,664 KB
testcase_05 AC 23 ms
7,748 KB
testcase_06 WA -
testcase_07 AC 23 ms
7,800 KB
testcase_08 AC 24 ms
7,796 KB
testcase_09 AC 24 ms
7,684 KB
testcase_10 AC 23 ms
7,796 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 62 ms
7,844 KB
testcase_15 AC 35 ms
7,668 KB
testcase_16 WA -
testcase_17 AC 30 ms
7,796 KB
testcase_18 AC 59 ms
7,784 KB
testcase_19 AC 30 ms
7,644 KB
testcase_20 AC 56 ms
7,872 KB
testcase_21 AC 35 ms
7,740 KB
testcase_22 WA -
testcase_23 AC 23 ms
7,624 KB
testcase_24 WA -
testcase_25 AC 59 ms
7,808 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 61 ms
7,896 KB
testcase_29 AC 62 ms
7,788 KB
testcase_30 AC 62 ms
7,948 KB
testcase_31 AC 64 ms
7,988 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import product
from fractions import gcd

g = input()

digits = sorted(map(eval, str(g)))

if len(set(digits)) == 1:
  print g
else:
  digit_len = len(str(g))
  digits = list(set(digits))
  G = g
  for x in product(digits, repeat=2):
    G = gcd(G, 9 * (x[0] - x[1]))
  print G
0