結果
| 問題 |
No.2953 Maximum Right Triangle
|
| コンテスト | |
| ユーザー |
テナガザル
|
| 提出日時 | 2024-11-08 21:32:01 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 655 bytes |
| コンパイル時間 | 945 ms |
| コンパイル使用メモリ | 91,996 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-08 21:32:15 |
| 合計ジャッジ時間 | 1,867 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 3 RE * 3 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
void solve()
{
long long d, x, y;
cin >> d >> x >> y;
int g = abs(__gcd(x, y));
long long ans = 0;
{
long long dx = y / g, dy = - x / g;
int k = min(x / dx, (d - y) / (-dy));
long long nx = x + dx * k, ny = y + dy * k;
ans = max(ans, (long long)abs(nx * y - ny * x));
}
{
long long dx = - y / g, dy = x / g;
int k = min(y / dy, (d - x) / (-dx));
long long nx = x + dx * k, ny = y + dy * k;
ans = max(ans, (long long)abs(nx * y - ny * x));
}
cout << ans << endl;
}
int main()
{
int t;
cin >> t;
while (t--) solve();
}
テナガザル