結果

問題 No.1090 ソーシャルディスタンス / Social Distance
ユーザー xRS43BofaUEZ5gc
提出日時 2021-03-29 13:56:51
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 553 bytes
コンパイル時間 4,466 ms
コンパイル使用メモリ 74,708 KB
実行使用メモリ 59,272 KB
最終ジャッジ日時 2024-11-29 09:47:26
合計ジャッジ時間 29,547 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 14 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;


public class HelloWorld {
		public static void main (String[] args) {
			Scanner sc = new Scanner(System.in);
			int n = sc.nextInt();
			int d = sc.nextInt();
			int[] ai = new int[n];
			ai[0] = 0;
			for (int i = 1;i < n; i ++) {
				ai[i] = sc.nextInt();
				if (ai[i] < ai[i - 1] + d) {
					ai[i] = ai[i - 1] + d;
				}else {
					ai[i] += ai[i - 1];
				}

			}
			sc.close();

			for (int i = 0; i < n; i ++) {
				System.out.print(ai[i]);
				if (i == n - 1) {
					break;
				}
				System.out.print(" ");
			}

	}
}
0