All submissions for this problem are available.
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.
Example
Input: 7 3 1 51 966369 7 9 999996 11 Output: 4
and here is my codechef INTEST - Enormous Input Test c++ solution: http://ideone.com/T05cEX
#include <iostream>
#include <cstdio>
using namespace std;
int main() {
// your code goes here
int a, b, c, d=0;
scanf("%d %d", &a, &b);
while (a--) {
scanf("%d", &c);
if(c%b==0) d++;
}
printf("%d", d);
return 0;
}
Note: I was looking for "buffer c++" all over the web, but I could not get over it. c++ "cin" and "cout" makes some WA. so, instead, just try c "scanf" and "printf", that would be helpful, and easy to understand. "buffer" is extremely difficult to me to understand the code. good luck guys.
No comments:
Post a Comment