結果
| 問題 |
No.443 GCD of Permutation
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-03-23 21:29:43 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 464 bytes |
| コンパイル時間 | 408 ms |
| コンパイル使用メモリ | 82,160 KB |
| 実行使用メモリ | 62,836 KB |
| 最終ジャッジ日時 | 2024-10-12 00:25:35 |
| 合計ジャッジ時間 | 3,024 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 WA * 1 |
| other | AC * 20 WA * 8 |
ソースコード
n = input()
if len(set(n)) == 1:
print(n)
exit()
tot = sum(map(int, n))
if tot % 9 == 0:
ans = 9
elif tot % 3 == 0:
ans = 3
else:
ans = 1
if all(int(x) % 4 == 0 for x in n):
ans *= 4
elif all(int(x) % 2 == 0 for x in n):
ans *= 2
if all(int(x) % 5 == 0 for x in n):
ans *= 5
if len(set(n)) == 2 and "0" in n:
for s in n:
if s != "0":
ans *= [0, 1, 1, 1, 1, 1, 1, 7, 2, 0][int(s)]
break
print(ans)