結果

問題 No.1423 Triangle of Multiples
ユーザー kpinkcatkpinkcat
提出日時 2023-09-04 23:05:22
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 896 bytes
コンパイル時間 2,289 ms
コンパイル使用メモリ 201,976 KB
実行使用メモリ 7,516 KB
最終ジャッジ日時 2023-09-04 23:05:32
合計ジャッジ時間 5,912 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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