結果

問題 No.443 GCD of Permutation
ユーザー lloyzlloyz
提出日時 2023-02-07 00:07:57
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 631 bytes
コンパイル時間 299 ms
コンパイル使用メモリ 87,172 KB
実行使用メモリ 76,200 KB
最終ジャッジ日時 2023-09-18 09:36:30
合計ジャッジ時間 4,606 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 76 ms
71,068 KB
testcase_02 AC 77 ms
70,908 KB
testcase_03 AC 75 ms
71,128 KB
testcase_04 AC 74 ms
70,900 KB
testcase_05 AC 75 ms
71,000 KB
testcase_06 AC 75 ms
70,928 KB
testcase_07 AC 76 ms
71,080 KB
testcase_08 AC 75 ms
70,980 KB
testcase_09 AC 76 ms
71,132 KB
testcase_10 AC 76 ms
70,856 KB
testcase_11 WA -
testcase_12 AC 78 ms
71,068 KB
testcase_13 AC 76 ms
71,144 KB
testcase_14 AC 77 ms
71,152 KB
testcase_15 AC 80 ms
75,760 KB
testcase_16 AC 77 ms
75,524 KB
testcase_17 AC 77 ms
75,668 KB
testcase_18 AC 81 ms
75,788 KB
testcase_19 AC 79 ms
75,700 KB
testcase_20 AC 80 ms
75,668 KB
testcase_21 AC 80 ms
75,744 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 79 ms
75,784 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 81 ms
76,044 KB
testcase_29 WA -
testcase_30 AC 81 ms
76,048 KB
testcase_31 AC 80 ms
75,748 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

s = input()

n = len(s)
for i in range(1, 10):
    if s == str(i) * n:
        print(s)
        exit()

C = [0 for _ in range(10)]
for i in range(n):
    C[int(s[i])] += 1

sum_ = 0
for i in range(10):
    sum_ += i * C[i]

ans = 1
if sum(C[0::9]) == n or sum_ % 9 == 0:
    ans *= 9
elif sum(C[0::3]) == n or sum_ % 3 == 0:
    ans *= 3
    if sum(C[0::6]) == n:
        ans *= 2
if sum(C[0::8]) == n:
    ans *= 8
elif sum(C[0::4]) == n:
    ans *= 4
elif sum(C[0::2]) == n and ans % 6 != 0:
    ans *= 2
    if sum(C[0::6]) == n:
        ans *= 3
if sum(C[0::7]) == n:
    ans *= 7
if sum(C[0::5]) == n:
    ans *= 5
print(ans)
0