-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcolumns2.cpp
More file actions
56 lines (46 loc) · 937 Bytes
/
columns2.cpp
File metadata and controls
56 lines (46 loc) · 937 Bytes
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include <iostream>
#include <fstream>
using namespace std;
int main() {
// uncomment the following lines if you want to read/write from files
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
long long N, K;
cin >> N >> K;
long long L[N];
for(long long i=0; i<N; i++)
cin >> L[i];
// insert your code here
long long C, num=0, resto=0, cut;
for (long long i=0; i<N; i++) {
C = L[i];
/*resto += C % K;
cut = C / K;
if (cut > 11) {
num += 10;
if (C-10*K == K) {
num ++;
resto += C-11*K;
} else {
resto += C-10*K;
}
} else {
num += cut;
}*/
for (int j=0; j<10; j++) {
if (C >= K) {
C -= K;
num ++;
} else {
break;
}
}
if (C == K) {
num ++;
} else {
resto += C;
}
}
cout << num << " " << resto << endl; // print the result
return 0;
}