結果
| 問題 |
No.2953 Maximum Right Triangle
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-11-08 21:53:30 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,153 bytes |
| コンパイル時間 | 5,359 ms |
| コンパイル使用メモリ | 308,352 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-08 21:53:39 |
| 合計ジャッジ時間 | 5,869 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 2 WA * 4 |
ソースコード
#include<bits/stdc++.h>
#include<atcoder/all>
namespace my{
using namespace std;
#define done(...) return pp(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;lin(__VA_ARGS__)
#define FO(n) for(ll ij=n;ij--;)
#define FOR(i,...) for(auto[i,i##stop,i##step]=range(0,__VA_ARGS__);i<i##stop;i+=i##step)
#define multiple_testcases void solve();}int main(){my::io();int T;std::cin>>T;while(T--)my::solve();}namespace my{
void io(){cin.tie(nullptr)->sync_with_stdio(0);cout<<fixed<<setprecision(15);}
using ll=long long;
template<class...A>auto range(bool s,A...a){array<ll,3>r{0,0,1};ll I=0;((r[I++]=a),...);if(!s&&I==1)swap(r[0],r[1]);r[0]-=s;return r;}
constexpr char nl=10;
constexpr char sp=32;
constexpr auto zz(auto x){return x<0?-x:x;}
auto min(const auto&...a){return min(initializer_list<common_type_t<decltype(a)...>>{a...});}
void lin(auto&...a){(cin>>...>>a);}
template<char c=sp>void pp(const auto&...a){ll n=sizeof...(a);((cout<<a<<string(--n>0,c)),...);cout<<nl;}
multiple_testcases
void solve(){
LL(D,a,b);
if(a<b)swap(a,b);
if(b==0)done(a*D);
ll t=min(a/b,(D-b)/a);
if(t==0)done(0);
ll c=a-t*b;
ll d=b+t*a;
pp(zz(a*d-b*c));
}}