Saturday, 11 February 2012

Codechef -> Practice -> Easy -> EnormousInputTest



Solution :



import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;

/**
 *
 * @author XCoder
 */
class EnormousInputTest {

    private static BufferedInputStream bis = new BufferedInputStream(System.in);
    private static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    public static int readIntLine() throws IOException {
        return Integer.parseInt(br.readLine());
    }

    public static long readLongLine() throws IOException {
        return Long.parseLong(br.readLine());
    }

    public static void main(String[] args) throws IOException {
        String s = br.readLine();
        int n = Integer.parseInt(s.split(" ")[0]);
        int k = Integer.parseInt(s.split(" ")[1]);
        int count = 0;
        while (n-- > 0) {
            if (readIntLine() % k == 0) {
                count++;
            }
        }
        System.out.println(count);
    }
}

No comments:

Post a Comment