結果

問題 No.1423 Triangle of Multiples
ユーザー kpinkcat
提出日時 2023-09-04 23:05:22
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 896 bytes
コンパイル時間 2,002 ms
コンパイル使用メモリ 198,012 KB
最終ジャッジ日時 2025-02-16 18:36:54
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other WA * 1 TLE * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include<iostream>
#include<map>
#include<vector>
#include <algorithm>
#include<math.h>
#include <iomanip>
#include<set>
#include <numeric>
#include<string>
using namespace std;


int main()
{
    int t;
    cin >> t;
    bool tang = false;
    for (int i = 0; i < t; i++){
        vector<int> abc(3);
        for (int j = 0; j < 3; j++) cin >> abc[j];
        sort(abc.begin(), abc.end());
        int a, b, c;
        a = abc[0];
        b = abc[1];
        c = abc[2];
        for (int j = 2; ; j++){
            b *= j;
            c *= j;
            for (int k = 0; k < b; k += a){
                if ((a+k+b) > c && (a+k+c) > b && (a+k) < (b+c)){
                    tang = true;
                    a += k;
                    break;
                }
            }
            if(tang) break;
        }
        cout << a << " " << b << " " << c << endl;
    }
}
0