-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEnormous Input Test
56 lines (42 loc) · 1.08 KB
/
Enormous Input Test
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
Problem
The purpose of this problem is to verify whether the method you are using to read input data is sufficiently fast to handle problems branded with the enormous Input/Output warning. You are expected to be able to process at least 2.5MB of input data per second at runtime.
Input
The input begins with two positive integers n k (n, k<=107). The next n lines of input contain one positive integer ti, not greater than 109, each.
Output
Write a single integer to output, denoting how many integers ti are divisible by k.
Sample 1:
Input
Output
7 3
1
51
966369
7
9
999996
11
4
Explanation:
The integers divisible by 33 are 51, 966369, 9,51,966369,9, and 999996999996. Thus, there are 44 integers in total.
Answer:
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
// Read the input n, k
int n, k;
cin >> n >> k;
// ans denotes number of integers n divisible by k
int ans = 0;
for (int i = 0; i < n; i++) {
int t;
cin >> t;
if (t % k == 0) {
ans++;
}
}
// Print the ans.
cout << ans << "\n";
return 0;
}