Please Fill out the Feedback Form for Code Radius

Enormous Input Test : INTEST | CodeChef Solution

2 min read

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 Format

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 Format

Write a single integer to output, denoting how many integers ti are divisible by k.

Constraints

Sample

Input
7 3
1
51
966369
7
9
999996
11
Output
4

Explanation

The integers divisible by 33 are 51, 966369, 9,51,966369,9, and 999996999996. Thus, there are 44 integers in total.

Solution

cpp
#include <iostream> using namespace std; // Solution from : Code Radius [ https://radiuscode.blogspot.com/ ] int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, k; cin >> n >> k; int ans = 0; for (int i = 0; i < n; i++) { int t; cin >> t; if (t % k == 0) { ans++; } } cout << ans << "\n"; return 0; }

Please First Try to Solve Problem by Yourself.

You may like these posts

Post a Comment