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