We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7438484 commit adcae6bCopy full SHA for adcae6b
839A/arya_and_bran.cpp renamed to 839A/arya-and-bran.cpp
@@ -4,33 +4,26 @@ using namespace std;
4
int main() {
5
int n, k;
6
cin >> n >> k;
7
-
8
int arya = 0, bran = 0;
9
int mnd = 0;
10
11
- for (int i = 0; i < n; ++i) {
+ for (int i = 0; i < n; i++) {
12
int today;
13
cin >> today;
14
15
if (today + arya >= 8) {
16
bran += 8;
17
arya += today - 8;
18
- ++mnd;
19
} else {
20
bran += today + arya;
21
arya = 0;
22
23
}
24
+ mnd++;
25
if (bran >= k) {
26
- cout << mnd << "\n";
+ cout << mnd << endl;
27
return 0;
28
29
30
31
if (bran < k) {
32
- cout << -1 << "\n";
+ cout << -1 << endl;
33
34
35
36
0 commit comments