結果

問題 No.443 GCD of Permutation
ユーザー nebukuro09nebukuro09
提出日時 2016-11-11 23:20:49
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 442 bytes
コンパイル時間 41 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-05-04 03:08:03
合計ジャッジ時間 1,157 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 10 ms
6,940 KB
testcase_02 AC 10 ms
6,940 KB
testcase_03 AC 10 ms
6,940 KB
testcase_04 AC 11 ms
6,944 KB
testcase_05 AC 11 ms
6,940 KB
testcase_06 AC 11 ms
6,940 KB
testcase_07 AC 10 ms
6,940 KB
testcase_08 WA -
testcase_09 AC 9 ms
6,944 KB
testcase_10 AC 9 ms
6,944 KB
testcase_11 WA -
testcase_12 AC 9 ms
6,940 KB
testcase_13 AC 9 ms
6,944 KB
testcase_14 AC 11 ms
6,940 KB
testcase_15 AC 9 ms
6,940 KB
testcase_16 AC 10 ms
6,944 KB
testcase_17 AC 11 ms
6,944 KB
testcase_18 AC 16 ms
6,940 KB
testcase_19 AC 10 ms
6,944 KB
testcase_20 AC 15 ms
6,940 KB
testcase_21 AC 11 ms
6,940 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 17 ms
6,940 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 10 ms
6,940 KB
testcase_29 WA -
testcase_30 AC 18 ms
6,940 KB
testcase_31 AC 13 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import combinations

N = raw_input()
if all(d==N[0] for d in N):
    print N
    exit()

ans = 1
S = set(N)

if len(S) == 2 and '0' in S:
    print sorted(list(S))[1]
    exit()

if all(int(d1+d2)%4==0 and int(d2+d1)%4 == 0 for d1, d2 in combinations(S, 2)):
    ans *= 4
elif all(int(d)%2==0 for d in S):
    ans *= 2

if sum(int(d) for d in N)%9 == 0:
    ans *= 9
elif sum(int(d) for d in N)%3 == 0:
    ans *= 3

print ans
0