結果
| 問題 |
No.443 GCD of Permutation
|
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 16:45:16 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 328 bytes |
| コンパイル時間 | 331 ms |
| コンパイル使用メモリ | 82,228 KB |
| 実行使用メモリ | 61,620 KB |
| 最終ジャッジ日時 | 2025-06-12 16:45:26 |
| 合計ジャッジ時間 | 2,401 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 14 WA * 14 |
ソースコード
n = input().strip()
# Check if all digits are the same
all_same = True
first = n[0]
for c in n:
if c != first:
all_same = False
break
if all_same:
print(n)
else:
s = sum(int(c) for c in n)
if s % 9 == 0:
print(s)
else:
import math
g = math.gcd(s, 9)
print(g)
gew1fw