結果
問題 |
No.443 GCD of Permutation
|
ユーザー |
|
提出日時 | 2017-12-19 16:10:34 |
言語 | D (dmd 2.109.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 439 bytes |
コンパイル時間 | 767 ms |
コンパイル使用メモリ | 110,196 KB |
実行使用メモリ | 13,752 KB |
最終ジャッジ日時 | 2024-06-12 23:12:43 |
合計ジャッジ時間 | 3,424 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 1 TLE * 1 -- * 26 |
コンパイルメッセージ
/home/linuxbrew/.linuxbrew/opt/dmd/include/dlang/dmd/std/numeric.d(2999): Warning: cannot inline function `std.numeric.gcdImpl!uint.gcdImpl`
ソースコード
import std.algorithm, std.conv, std.range, std.stdio, std.string; import std.numeric; // gcd, fft void main() { auto n = readln.chomp.to!int, m = n; int[] a; while (m > 1) { a ~= m % 10; m /= 10; } a = a.sort().uniq.array; auto na = a.length; if (na == 1) { writeln(n); return; } auto ans = n; foreach (i; 0..na-1) foreach (j; i+1..na) ans = gcd(ans, 9*(a[j]-a[i])); writeln(ans); }