結果

問題 No.31 悪のミックスジュース
ユーザー dnishdnish
提出日時 2018-06-14 16:00:06
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 839 bytes
コンパイル時間 1,370 ms
コンパイル使用メモリ 165,412 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-13 04:09:07
合計ジャッジ時間 2,654 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 1 ms
4,380 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 1 ms
4,376 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
#define REP(i,n,N) for(int i=(n); i<(N); i++)
#define RREP(i,n,N) for(int i=(N-1); i>=n; i--)
#define CK(n,a,b) (a)<=(n)&&(n)<(b)
#define ALL(v) (v).begin(),(v).end()
#define p(s) cout<<(s)<<endl
typedef long long ll;
using namespace std;
const ll mod =1e6+7;

ll N,V;

int main(){
    while(cin>>N>>V){
        ll ans=0;
        ll C[110] = {};
        REP(i,0,N){
            cin>>C[i];
        }
        int ind=N;
        REP(i,0,N){
            ans+=C[i];
            if(ind==N&&C[i]<C[i+1]){
                ind=i+1;
            }
        }
        if(N>=V){
            p(ans);
        }else{
            V-=N;
            int d1 = V/ind;
            int d2 = V%ind;
            REP(i,0,ind){
                ans+=C[i]*(d1+(d2>0));
                d2--;
            }
            p(ans);
        }

    }

}
0