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

  • ProblemYou and your friend are playing a game with hoops. There are N hoops (where N is odd) in a row. You jump into hoop 1, and your friend jumps into hoop N. Then you jump into h…
  •  ProblemChefland has 2 different types of coconut, type A and type B. Type A contains only x_a milliliters of coconut water and type B contains only x_b grams of coconut pulp.…
  • ProblemAlice and Bob are meeting after a long time. As usual they love to play some math games. This times Alice takes the call and decides the game. The game is very simple, Alice…
  • Problem In mathematics, the degree of polynomials in one variable is the highest power of the variable in the algebraic expression with non-zero coefficient.Chef has a polynomial…
  • ProblemIf Give an integer N . Write a program to obtain the sum of the first and last digits of this number. Please Share this article... Input Format The first line contains a…
  •  ProblemChef is a big fan of Coldplay. Every Sunday, he will drive to a park taking M minutes to reach there, and during the ride he will play a single song on a loop. Today, …

Post a Comment