結果

問題 No.31 悪のミックスジュース
ユーザー omochana1omochana1
提出日時 2014-12-03 00:23:44
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,066 bytes
コンパイル時間 682 ms
コンパイル使用メモリ 86,448 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-02 01:19:55
合計ジャッジ時間 1,989 ms
ジャッジサーバーID
(参考情報)
judge12 / judge16
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <string.h>
#include <map>
#include <fstream>
#include <functional>
#include <bitset>
#include <iomanip>
#include <stack>
#include <set>
#include <climits>
#define MAX_N 510
#define PI 3.141592653589
#define ESP 1e-20
#define BS 10
#define MOD 1000000007 
#define ZERO 10001
#define YJSNPI 810
#define INF (1LL << 50)
#define ADD(a, b) a = (a + (ll)b) % MOD
#define MUL(a, b) a = (a * (ll)b) % MOD
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;

int N;
ll M;
ll sum[110];

int main() {
	scanf("%d%d", &N, &M);
	for(int i = 0; i < N; i++) {
		scanf("%d", &sum[i + 1]);
		sum[i + 1] += sum[i];
	}
	M -= N;
	if(M <= 0) {
		cout << sum[N] << endl; return 0;
	}
	ll res = INF;
	for(int i = 1; i <= N; i++) {
		res = min(res, (M / i) * sum[i] + sum[M % i]);
	}
	cout << res + sum[N] << endl;
}
0