結果
| 問題 |
No.31 悪のミックスジュース
|
| コンテスト | |
| ユーザー |
startcpp
|
| 提出日時 | 2018-02-08 21:09:54 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 637 bytes |
| コンパイル時間 | 378 ms |
| コンパイル使用メモリ | 55,292 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-25 02:23:23 |
| 合計ジャッジ時間 | 1,148 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 5 WA * 12 |
ソースコード
#include <iostream>
#define int long long
using namespace std;
int n, v;
int c[100];
signed main() {
int i;
int ans = 0;
int sumC = 0;
cin >> n >> v;
for (i = 0; i < n; i++) cin >> c[i];
for (i = 0; i < n; i++) sumC += c[i];
v -= n;
ans += sumC;
if (v <= 0) { cout << ans << endl; return 0; }
int minC = 1145141919;
int pos = -1;
for (i = 0; i < n; i++) {
if (minC > c[i]) {
minC = c[i];
pos = i;
}
}
int syo = v / (pos + 1);
int mod = v % (pos + 1);
for (i = 0; i < mod; i++) {
ans += (syo + 1) * c[i];
}
for (i = mod; i <= pos; i++) {
ans += syo * c[i];
}
cout << ans << endl;
return 0;
}
startcpp