結果

問題 No.1423 Triangle of Multiples
ユーザー 213R213R
提出日時 2021-03-15 23:53:55
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,483 bytes
コンパイル時間 5,158 ms
コンパイル使用メモリ 258,964 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-25 02:58:27
合計ジャッジ時間 5,387 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <bits/stdc++.h>
#include <atcoder/all>
        
using namespace std;
using namespace atcoder;
using mint = modint998244353;
using ll=long long;
 
bool chmin(ll& a, ll b){ if(a > b){ a = b; return 1; } return 0; }
bool chmax(int& a, int b){ if(a < b){ a = b; return 1; } return 0; }
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
const ll MOD = 998244353LL;
using pll = pair<int, int>;
const int INF = 1e7;

vector<int> sieve(int X) {
    vector<bool> cs(X+1, true);
    for (int i = 2; i*i <= X; ++i) {
        if (cs[i]) {
            for (int j = i*i; j <= X; j+=i) cs[j] = false;
        }
    }
    vector<int> ans;
    for (int i = 2; i <= X; ++i) if (cs[i]) ans.push_back(i);
    return ans;
}

ll gcd(ll a, ll b) {
    if (b==0) return a;
    return gcd(b, a%b);
}


int main() {
    int T;
    cin >> T;
    vector<ll> xs(3);
    vector ans(T, vector<ll>(3));
    for (int i = 0; i < T; ++i) {
        cin >> xs[0] >> xs[1] >> xs[2];
        sort(xs.begin(), xs.end());
        ll a = xs[0], b = xs[1], c = xs[2];
        int j = 2;
        while (xs[0] + xs[1] <= xs[2]) {
            xs[2] = c*j;
            xs[1] = ((xs[2]-1)/b)*b;
            xs[0] = ((xs[1]-1)/c)*c;
            j++;
        }
        ans[i][0] = xs[0];
        ans[i][1] = xs[1];
        ans[i][2] = xs[2];
    }    
    for (auto v : ans) {
        cout << v[0] << " ";
        cout << v[1] << " ";
        cout << v[2] << endl;
    }
    return 0;
}
0