結果

問題 No.2953 Maximum Right Triangle
ユーザー syuya2036
提出日時 2024-11-08 23:06:19
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 646 bytes
コンパイル時間 1,817 ms
コンパイル使用メモリ 166,160 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-08 23:06:29
合計ジャッジ時間 2,572 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other WA * 3 RE * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int T; cin>>T;
    while(T--) {
        long long x, y, D;
        cin>>D>>x>>y;
        long long ans = 0;

        {
            long long mt = min((D-y)/x, x/y);
            long long i = y+mt*x;
            long long j = x-mt*y;
            ans = max(ans, abs(x*i - y*j));
        }
        {
            long long mt = min((D-x)/y, y/x);
            long long i = y-mt*x;
            long long j = x+mt*y;
            ans = max(ans, abs(x*i - y*j));
        }
        cout<<ans<<endl;
    }
}

0