結果
| 問題 |
No.3020 ユークリッドの互除法・改
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-02-14 23:32:33 |
| 言語 | D (dmd 2.109.1) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 339 bytes |
| コンパイル時間 | 5,065 ms |
| コンパイル使用メモリ | 166,180 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2025-02-14 23:34:07 |
| 合計ジャッジ時間 | 5,875 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
コンパイルメッセージ
/home/linuxbrew/.linuxbrew/opt/dmd/include/dlang/dmd/std/numeric.d(2999): Warning: cannot inline function `std.numeric.gcdImpl!ulong.gcdImpl` /home/linuxbrew/.linuxbrew/opt/dmd/include/dlang/dmd/std/numeric.d(2999): Warning: cannot inline function `std.numeric.gcdImpl!ulong.gcdImpl`
ソースコード
import std;
import core.bitop;
import core.checkedint;
import core.time;
void main() {
const a = readln.split.to!(int[]);
const b = readln.split.to!(int[]);
const c = (a ~ b).to!(long[]);
const g = c.fold!(gcd);
if(g == 0) {
writeln("0 0");
} else {
writeln(g, " ", abs(c[0] * c[3] - c[1] * c[2]) / g);
}
}