Submission #00055


ソースコード

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include "bits/stdc++.h"
using namespace std;
using imax = std::intmax_t;
using usize = std::size_t;
#define rep(i, b, e) for (imax i = (b); i < (e); ++i)
#define repc(i, b, e) for (imax i = (b); i <= (e); ++i)
#define all(v) begin(v), end(v)
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
usize N, M;
while (cin >> N >> M, N && M) {
imax res = 0;
vector<int> a(N);
for (auto &ai: a) cin >> ai;
const int need = M / N;
for (auto ai: a) {
res += min(need, ai);
}
cout << res << "\n";
}
return 0;
}

ステータス

項目 データ
問題 0002 - 割り勘
ユーザー名 もけ
投稿日時 2020-03-27 09:33:17
言語 C++17
状態 Accepted
得点 8
ソースコード長 618 Byte
最大実行時間 27 ms
最大メモリ使用量 684 KB

セット

セット 得点 Cases
1 A1 2 / 2 A1
2 A2 2 / 2 A2
3 A3 2 / 2 A3
4 A4 2 / 2 A4

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
A1 AC 19 ms 604 KB
1
A2 AC 24 ms 684 KB
2
A3 AC 27 ms 508 KB
3
A4 AC 19 ms 464 KB
4