結果

問題 No.356 円周上を回る3つの動点の一致
コンテスト
ユーザー nebukuro09
提出日時 2017-03-09 20:17:00
言語 D
(dmd 2.112.0)
コンパイル:
dmd -fPIE -m64 -w -wi -O -release -inline -I/opt/dmd/src/druntime/import/ -I/opt/dmd/src/phobos -L-L/opt/dmd/linux/lib64/ -fPIC _filename_
実行:
./Main
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 559 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 612 ms
コンパイル使用メモリ 101,384 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2026-03-05 13:15:41
合計ジャッジ時間 2,394 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 48
権限があれば一括ダウンロードができます
コンパイルメッセージ
/home/linuxbrew/.linuxbrew/opt/dmd/include/dlang/dmd/std/numeric.d(3011): Warning: cannot inline function `std.numeric.gcdImpl!ulong.gcdImpl`
private typeof(T.init % T.init) gcdImpl(T)(T a, T b)
                                ^

ソースコード

diff #
raw source code

import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.stdio;


void main() {
    auto s = 3.iota.map!(_ => readln.chomp.to!long).array.sort();
    auto t1 = s[0];
    auto t2 = s[1];
    auto t3 = s[2];

    auto a = (t3 - t1) * t1 * t2;
    auto b = (t2 - t1) * t1 * t3;
    auto c = gcd(a, b);
    a /= c;
    b /= c;

    auto d = t1 * t2 * b;
    auto e = t2 - t1;
    auto f = gcd(d, e);
    writeln(d/f, "/", e/f);

}
0