結果

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

ソースコード

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 < c; 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