結果
| 問題 | No.443 GCD of Permutation | 
| コンテスト | |
| ユーザー |  gew1fw | 
| 提出日時 | 2025-06-12 21:17:28 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 628 bytes | 
| コンパイル時間 | 181 ms | 
| コンパイル使用メモリ | 82,380 KB | 
| 実行使用メモリ | 62,720 KB | 
| 最終ジャッジ日時 | 2025-06-12 21:18:02 | 
| 合計ジャッジ時間 | 2,242 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 19 WA * 9 | 
ソースコード
n = input().strip()
# Check if all digits are the same
if len(set(n)) == 1:
    print(n)
else:
    sum_digits = sum(int(c) for c in n)
    sum_factor = 9 if sum_digits % 9 == 0 else (3 if sum_digits % 3 == 0 else 1)
    
    # Check if all digits are even
    all_even = all(int(c) % 2 == 0 for c in n)
    if all_even:
        all_048 = all(c in {'0', '4', '8'} for c in n)
        k = 2 if all_048 else 1
    else:
        k = 0
    
    # Check if all digits are 0 or 5
    all_0_or_5 = all(c in {'0', '5'} for c in n)
    m = 1 if all_0_or_5 else 0
    
    gcd_value = sum_factor * (2 ** k) * (5 ** m)
    print(gcd_value)
            
            
            
        