結果

問題 No.1423 Triangle of Multiples
ユーザー ks2mks2m
提出日時 2021-03-12 21:38:31
言語 Java21
(openjdk 21)
結果
AC  
実行時間 550 ms / 2,000 ms
コード長 930 bytes
コンパイル時間 2,402 ms
コンパイル使用メモリ 78,608 KB
実行使用メモリ 59,272 KB
最終ジャッジ日時 2023-08-04 14:47:06
合計ジャッジ時間 4,882 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
53,540 KB
testcase_01 AC 82 ms
52,816 KB
testcase_02 AC 550 ms
58,048 KB
testcase_03 AC 499 ms
58,740 KB
testcase_04 AC 500 ms
59,272 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int t = Integer.parseInt(br.readLine());
		PrintWriter pw = new PrintWriter(System.out);
		for (int z = 0; z < t; z++) {
			String[] sa = br.readLine().split(" ");
			Obj[] a = new Obj[3];
			for (int i = 0; i < 3; i++) {
				Obj o = new Obj();
				o.i = i;
				o.a = Integer.parseInt(sa[i]);
				o.x = o.a;
				a[i] = o;
			}
			Arrays.sort(a, (o1, o2) -> o1.a - o2.a);
			if (a[0].x + a[1].x <= a[2].x) {
				a[0].x = (a[1].x + a[2].x - 1) / a[0].a * a[0].a;
			}
			Arrays.sort(a, (o1, o2) -> o1.i - o2.i);
			System.out.println(a[0].x + " " + a[1].x + " " + a[2].x);
		}
		pw.flush();
		br.close();
	}

	static class Obj {
		int i, a;
		long x;
	}
}
0