結果
| 問題 |
No.1090 ソーシャルディスタンス / Social Distance
|
| ユーザー |
RISE70226821
|
| 提出日時 | 2020-08-04 12:58:07 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 1,278 ms / 2,000 ms |
| コード長 | 696 bytes |
| コンパイル時間 | 2,576 ms |
| コンパイル使用メモリ | 76,840 KB |
| 実行使用メモリ | 59,376 KB |
| 最終ジャッジ日時 | 2024-09-14 13:45:25 |
| 合計ジャッジ時間 | 25,237 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 23 |
ソースコード
import java.util.*;
import java.lang.*;
import java.io.*;
public class Main {
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
// 入力
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int D = sc.nextInt();
int[] pos = new int[N];
pos[0] = 0;
for(int i = 1; i < N; i++){
int dist = sc.nextInt();
pos[i] = pos[i-1] + dist;
}
// 再整列
for(int i = 1; i < N; i++){
if(pos[i] - pos[i-1] < D){
pos[i] = pos[i-1] + D;
}
}
// 出力
System.out.print(pos[0]);
for(int i = 1; i < N; i++){
System.out.print(" " + pos[i]);
}
System.out.println("");
}
}
RISE70226821