結果
| 問題 | No.229 線分上を往復する3つの動点の一致 |
| コンテスト | |
| ユーザー |
maine_honzuki
|
| 提出日時 | 2020-12-26 01:33:15 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 738 bytes |
| 記録 | |
| コンパイル時間 | 1,922 ms |
| コンパイル使用メモリ | 212,896 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-06-16 06:14:27 |
| 合計ジャッジ時間 | 3,616 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 43 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
vector<ll> T(3);
for (int i = 0; i < 3; i++) {
cin >> T[i];
}
ll D = T[0] * T[1] * T[2];
pair<long, long> ans{D, 1ll};
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++) {
ll N1 = T[1] * (T[2] + T[0] * (i ? 1 : -1));
ll N2 = T[0] * (T[2] + T[1] * (j ? 1 : -1));
pair<long, long> now{D, gcd(N1, N2)};
ll tmp = gcd(now.first, now.second);
now.first /= tmp;
now.second /= tmp;
if (ans.first * now.second > ans.second * now.first)
ans = now;
}
}
cout << ans.first << "/" << ans.second << endl;
}
maine_honzuki