結果
| 問題 |
No.443 GCD of Permutation
|
| コンテスト | |
| ユーザー |
WSKR
|
| 提出日時 | 2020-09-23 15:40:30 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 497 bytes |
| コンパイル時間 | 86 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 11,136 KB |
| 最終ジャッジ日時 | 2024-06-27 22:41:56 |
| 合計ジャッジ時間 | 2,323 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 19 WA * 8 RE * 1 |
ソースコード
#gcd of permutation
from math import gcd
def main():
s = input()
a = list(map(int, list(s)))
a.sort()
N = len(a)
if a[0] == a[-1]:
print(int(s))
return
else:
ans = 1
#2
ans *= min(gcd(a[i], 8) for i in range(N))
#3
ans *= gcd(sum(a), 9)
#5
if all(a[i] % 5 == 0 for i in range(N)):
ans *= 5
#7:impossible
print(ans)
return
if __name__ == "__main__":
main()
WSKR