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

  • 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/Ou…
  • Problem Gru has not been in the limelight for a long time and is, therefore, planning something particularly nefarious. Frustrated by his minions' incapability which has kept him…
  •  ProblemYou're given an integer N. Write a program to calculate the sum of all the digits of N. Please Share this article... Input Format The first line contains an intege…
  • Problem Write a program to obtain a number NN and increment its value by 1 if the number is divisible by 4 otherwise decrement its value by 1. Please Share this article... …
  • Problem In a Chess match "a + b", each player has a clock which shows a minutes at the start and whenever a player makes a move, b seconds are added to this player's clock. Ti…
  • Problem Chef has just started Programming, he is in first year of Engineering. Chef is reading about Relational Operators.Relational Operators are operators which check relati…

Post a Comment