結果

問題 No.1090 ソーシャルディスタンス / Social Distance
ユーザー kotatsugame
提出日時 2020-06-24 07:07:54
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 157 ms / 2,000 ms
コード長 240 bytes
コンパイル時間 470 ms
コンパイル使用メモリ 62,592 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-03 19:55:37
合計ジャッジ時間 3,777 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    4 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
using namespace std;
int N,D;
main()
{
    cin>>N>>D;
    cout<<0;
    int S=0,P=0;
    for(int i=1;i<N;i++)
    {
        int A;cin>>A;
        S+=A;
        if(P+D<S)P=S;
        else P+=D;
        cout<<" "<<P;
    }
}
0