-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathd.cpp
More file actions
44 lines (38 loc) · 835 Bytes
/
Copy pathd.cpp
File metadata and controls
44 lines (38 loc) · 835 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
#include <algorithm>
#include <stack>
#include <bitset>
#include <cassert>
#include <map>
#include <string>
#include <iostream>
#include <queue>
#include <set>
#include <vector>
#include <cmath>
#include <limits>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
#define sz(x) int((x).size())
#define FOR(i,a,b) for(int (i) = (a); (i) < (b); ++(i))
#define REP(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define square(a) (a)*(a)
#define mp(a,b) make_pair((a),(b))
const int oo = numeric_limits<int>::max();
int main() {
int n, f[51], c;
cin >> n;
REP(i, n) {
cin >> f[i];
}
cin >> c;
long long cnt = 0;
REP(i, n) {
if (f[i] % c != 0)
cnt++;
cnt += f[i]/c;
}
cout << cnt*c << endl;
}