結果

問題 No.970 数列変換マシン
ユーザー C_nena_E
提出日時 2020-01-17 22:05:07
言語 Java
(openjdk 23)
結果
AC  
実行時間 1,426 ms / 2,000 ms
コード長 665 bytes
コンパイル時間 3,761 ms
コンパイル使用メモリ 85,196 KB
実行使用メモリ 61,732 KB
最終ジャッジ日時 2024-06-25 20:16:01
合計ジャッジ時間 21,386 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int total = 0;
        List<Integer> li = new ArrayList<Integer>();
        for(int i = 0; i < n; i++){
            int tmp = sc.nextInt();
            li.add(tmp);
            total += tmp;
        }
        int i = 0;
        for(int v: li){
            if(i == n-1){
                System.out.print(total-v*(n-1));
            }else{
                System.out.print(total-v*(n-1)+" ");
            }
            i++;
        }
    }
}

0