結果

問題 No.970 数列変換マシン
ユーザー htensaihtensai
提出日時 2020-01-18 18:58:19
言語 Java21
(openjdk 21)
結果
AC  
実行時間 249 ms / 2,000 ms
コード長 773 bytes
コンパイル時間 3,754 ms
コンパイル使用メモリ 72,480 KB
実行使用メモリ 63,364 KB
最終ジャッジ日時 2023-09-10 09:19:04
合計ジャッジ時間 9,867 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 249 ms
62,984 KB
testcase_01 AC 249 ms
63,364 KB
testcase_02 AC 239 ms
62,548 KB
testcase_03 AC 240 ms
60,472 KB
testcase_04 AC 232 ms
60,492 KB
testcase_05 AC 241 ms
62,576 KB
testcase_06 AC 196 ms
60,236 KB
testcase_07 AC 239 ms
60,696 KB
testcase_08 AC 233 ms
60,852 KB
testcase_09 AC 52 ms
49,628 KB
testcase_10 AC 51 ms
49,528 KB
testcase_11 AC 58 ms
51,540 KB
testcase_12 AC 54 ms
50,328 KB
testcase_13 AC 61 ms
49,784 KB
testcase_14 AC 74 ms
51,336 KB
testcase_15 AC 41 ms
49,796 KB
testcase_16 AC 42 ms
49,296 KB
testcase_17 AC 42 ms
49,888 KB
testcase_18 AC 42 ms
49,572 KB
testcase_19 AC 42 ms
49,352 KB
testcase_20 AC 41 ms
49,416 KB
testcase_21 AC 41 ms
49,384 KB
testcase_22 AC 46 ms
49,288 KB
testcase_23 AC 41 ms
49,460 KB
testcase_24 AC 46 ms
49,296 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        String[] line = br.readLine().split(" ", n);
        long[] arr = new long[n];
        long total = 0;
        for (int i = 0; i < n; i++) {
            arr[i] = Integer.parseInt(line[i]);
            total += arr[i];
        }
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < n; i++) {
            if (i != 0) {
                sb.append(" ");
            }
            long ans = total - arr[i] * (n - 1);
            sb.append(ans);
        }
        System.out.println(sb);
    }
}
0