結果

問題 No.1423 Triangle of Multiples
ユーザー e869120e869120
提出日時 2021-03-12 21:25:06
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 668 bytes
コンパイル時間 809 ms
コンパイル使用メモリ 86,520 KB
実行使用メモリ 6,940 KB
最終ジャッジ日時 2024-04-22 12:04:03
合計ジャッジ時間 1,600 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
using namespace std;

void solve(long long A, long long B, long long C) {
	while (true) {
		long long t[3] = { A, B, C };
		sort(t, t + 3);
		if (t[0] + t[1] > t[2]) break;
		if (A <= B && A <= C) { A = (B / A + 1LL) * A; }
		else if (B <= A && B <= C) { B = (C / B + 1LL) * B; }
		else if (C <= A && C <= B) { C = (A / C + 1LL) * A; }
	}
	cout << A << " " << B << " " << C << endl;
}

int main() {
	long long T, A, B, C;
	cin >> T;
	for (int i = 1; i <= T; i++) {
		cin >> A >> B >> C;
		solve(A, B, C);
	}
	return 0;
}
0