結果
問題 |
No.443 GCD of Permutation
|
ユーザー |
![]() |
提出日時 | 2016-11-11 23:29:53 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 420 bytes |
コンパイル時間 | 104 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 11,008 KB |
最終ジャッジ日時 | 2024-11-25 09:32:05 |
合計ジャッジ時間 | 7,560 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 5 WA * 10 RE * 13 |
ソースコード
def c_number(N): n=0 for i in range(len(N)): n+=N[i]*(10**i) return n N=list(map(int,list(input()))) n=set(N) if len(n)==1: print(c_number(N)); exit() if len(n)==2 and 0 in n: print(c_number(sorted(N,reverse=True)));exit() s=c_number(N) if s//9 != s/9: print(1); exit() min_diff=10 for i in n: for j in n-{i}: if max(i-j,j-i)<min_diff: min_diff = max(i-j,j-1) s=(i,j) else: print((max(i,j)-min(i,j))*9)