結果

問題 No.3433 [Cherry 8th Tune A] ADD OIL!
コンテスト
ユーザー ks2m
提出日時 2026-01-23 22:27:11
言語 Java
(openjdk 25.0.1)
結果
AC  
実行時間 214 ms / 2,000 ms
コード長 521 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 7,149 ms
コンパイル使用メモリ 82,340 KB
実行使用メモリ 49,496 KB
最終ジャッジ日時 2026-01-23 22:28:12
合計ジャッジ時間 9,440 ms
ジャッジサーバーID
(参考情報)
judge4 / judge6
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int t = sc.nextInt();
		for (int z = 0; z < t; z++) {
			int n = sc.nextInt();
			int k = sc.nextInt();
			int[] a = new int[n];
			for (int i = 0; i < n; i++) {
				a[i] = sc.nextInt();
			}
			Arrays.sort(a);

			a[0] -= k;
			long ans = 1;
			for (int i = 0; i < n; i++) {
				ans *= a[i];
			}
			System.out.println(ans);
		}
		sc.close();
	}
}
0