結果
問題 | No.970 数列変換マシン |
ユーザー |
![]() |
提出日時 | 2020-03-05 21:50:35 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 618 ms / 2,000 ms |
コード長 | 1,291 bytes |
コンパイル時間 | 1,984 ms |
コンパイル使用メモリ | 77,516 KB |
実行使用メモリ | 60,924 KB |
最終ジャッジ日時 | 2024-10-14 02:09:24 |
合計ジャッジ時間 | 11,260 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Scanner; /** * Built using CHelper plug-in * Actual solution is at the top * * @author silviase */ public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; Scanner in = new Scanner(inputStream); PrintWriter out = new PrintWriter(outputStream); SeqenceChange solver = new SeqenceChange(); solver.solve(1, in, out); out.close(); } static class SeqenceChange { public void solve(int testNumber, Scanner in, PrintWriter out) { int n = in.nextInt(); long[] a = new long[n]; long sum = 0; StringBuilder sb = new StringBuilder(); for (int i = 0; i < n; i++) { a[i] = in.nextLong(); sum += a[i]; } for (int i = 0; i < n; i++) { if (i > 0) { sb.append(" "); } // 他n-1個の算術平均なので sb.append(sum - a[i] * (n - 1)); } out.println(sb.toString()); } } }