結果
| 問題 | No.443 GCD of Permutation |
| コンテスト | |
| ユーザー |
はむ吉🐹
|
| 提出日時 | 2016-11-14 22:51:05 |
| 言語 | Python3 (3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL) |
| 結果 |
RE
不安定
|
| 実行時間 | - |
| コード長 | 356 bytes |
| 記録 | |
| コンパイル時間 | 54 ms |
| コンパイル使用メモリ | 15,232 KB |
| 実行使用メモリ | 13,696 KB |
| 最終ジャッジ日時 | 2026-09-30 03:07:59 |
| 合計ジャッジ時間 | 3,229 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | RE * 4 |
| other | RE * 28 |
ソースコード
#!/usr/bin/env python3
import fractions
import functools
import itertools
def gcd_of_permutations(n):
ds = (int(d) for d in str(n))
xs = (9 * abs(a - b) for a, b in itertools.combinations(ds, 2))
return functools.reduce(fractions.gcd, xs, n)
def main():
print(gcd_of_permutations(int(input())))
if __name__ == '__main__':
main()
はむ吉🐹