結果
| 問題 | No.443 GCD of Permutation |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-12-19 16:10:34 |
| 言語 | D (dmd 2.112.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 439 bytes |
| 記録 | |
| コンパイル時間 | 559 ms |
| コンパイル使用メモリ | 94,212 KB |
| 実行使用メモリ | 10,020 KB |
| 最終ジャッジ日時 | 2026-03-05 18:10:44 |
| 合計ジャッジ時間 | 3,801 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 9 RE * 18 TLE * 1 |
コンパイルメッセージ
/home/linuxbrew/.linuxbrew/opt/dmd/include/dlang/dmd/std/numeric.d(3011): Warning: cannot inline function `std.numeric.gcdImpl!uint.gcdImpl`
private typeof(T.init % T.init) gcdImpl(T)(T a, T b)
^
ソースコード
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);
}