結果

問題 No.1389 Clumsy Calculation
ユーザー ks2mks2m
提出日時 2021-02-12 21:47:50
言語 Java19
(openjdk 21)
結果
AC  
実行時間 837 ms / 2,000 ms
コード長 408 bytes
コンパイル時間 2,086 ms
コンパイル使用メモリ 71,112 KB
実行使用メモリ 66,492 KB
最終ジャッジ日時 2023-09-27 03:36:31
合計ジャッジ時間 18,583 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
55,848 KB
testcase_01 AC 125 ms
55,708 KB
testcase_02 AC 124 ms
55,796 KB
testcase_03 AC 206 ms
58,352 KB
testcase_04 AC 205 ms
56,692 KB
testcase_05 AC 213 ms
59,812 KB
testcase_06 AC 213 ms
58,768 KB
testcase_07 AC 211 ms
58,892 KB
testcase_08 AC 125 ms
55,916 KB
testcase_09 AC 837 ms
64,780 KB
testcase_10 AC 619 ms
66,492 KB
testcase_11 AC 204 ms
58,580 KB
testcase_12 AC 196 ms
58,544 KB
testcase_13 AC 193 ms
58,672 KB
testcase_14 AC 743 ms
64,580 KB
testcase_15 AC 745 ms
64,776 KB
testcase_16 AC 723 ms
64,776 KB
testcase_17 AC 737 ms
64,408 KB
testcase_18 AC 727 ms
64,580 KB
testcase_19 AC 734 ms
62,396 KB
testcase_20 AC 738 ms
62,792 KB
testcase_21 AC 743 ms
64,628 KB
testcase_22 AC 746 ms
64,852 KB
testcase_23 AC 748 ms
64,536 KB
testcase_24 AC 744 ms
64,688 KB
testcase_25 AC 753 ms
64,872 KB
testcase_26 AC 733 ms
64,968 KB
testcase_27 AC 744 ms
64,836 KB
testcase_28 AC 743 ms
64,728 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long x = sc.nextInt();
		int[] s = new int[n];
		for (int i = 0; i < n; i++) {
			s[i] = sc.nextInt();
		}
		sc.close();

		long sum = 0;
		for (int i = 0; i < n; i++) {
			sum += s[i];
		}

		System.out.println(sum - x * (n - 1));
	}
}
0