結果
| 問題 | No.280 歯車の問題(1) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-11-06 19:30:52 |
| 言語 | D (dmd 2.113.0) |
| 結果 |
AC
不安定
|
| 実行時間 | 2 ms / 1,000 ms |
| + 656µs | |
| コード長 | 363 bytes |
| 記録 | |
| コンパイル時間 | 1,730 ms |
| コンパイル使用メモリ | 201,184 KB |
| 実行使用メモリ | 9,876 KB |
| 最終ジャッジ日時 | 2026-11-06 19:31:00 |
| 合計ジャッジ時間 | 5,316 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 33 |
コンパイルメッセージ
/home/linuxbrew/.linuxbrew/opt/dmd/include/dlang/dmd/std/numeric.d(3142): Warning: cannot inline function `std.numeric.gcdImpl!(BigInt).gcdImpl`
private auto gcdImpl(T)(T a, T b)
^
ソースコード
module main;
import std;
void main()
{
// 入力
int N = readln.chomp.to!int;
auto Z = readln.split.map!(a => BigInt(a)).array;
// 答えの計算
BigInt g = gcd(Z[0], Z[1]);
BigInt a = Z[1] / g, b = Z[0] / g;
foreach (i; 1 .. N - 1) {
a *= Z[i + 1];
b *= Z[i];
g = gcd(a, b);
a /= g;
b /= g;
}
// 答えの出力
writefln("%d/%d", a, b);
}