結果
| 問題 | 
                            No.1090 ソーシャルディスタンス / Social Distance
                             | 
                    
| ユーザー | 
                             tenten
                         | 
                    
| 提出日時 | 2020-12-07 09:54:03 | 
| 言語 | Java  (openjdk 23)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 562 ms / 2,000 ms | 
| コード長 | 558 bytes | 
| コンパイル時間 | 2,571 ms | 
| コンパイル使用メモリ | 74,560 KB | 
| 実行使用メモリ | 61,568 KB | 
| 最終ジャッジ日時 | 2024-09-17 13:39:03 | 
| 合計ジャッジ時間 | 13,888 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 23 | 
ソースコード
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int d = sc.nextInt();
        int[] arr = new int[n];
        int[] ans = new int[n];
        StringBuilder sb = new StringBuilder();
        sb.append(0);
        for (int i = 1; i < n; i++) {
            arr[i] = sc.nextInt() + arr[i - 1];
            ans[i] = Math.max(arr[i], ans[i - 1] + d);
            sb.append(" ").append(ans[i]);
        }
        System.out.println(sb);
    }
}
            
            
            
        
            
tenten