-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathreadInt().cpp
More file actions
52 lines (48 loc) · 807 Bytes
/
readInt().cpp
File metadata and controls
52 lines (48 loc) · 807 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include<iostream>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<fstream>
#include<cmath>
#include<algorithm>
#include<stdio.h>
#include<cstring>
#include<list>
using namespace std;
int readInt () {
bool minus = false;
int result = 0;
char ch;
ch = getchar();
while (true) {
if (ch == '-') break;
if (ch >= '0' && ch <= '9') break;
ch = getchar();
}
if (ch == '-') minus = true; else result = ch-'0';
while (true) {
ch = getchar();
if (ch < '0' || ch > '9') break;
result = result*10 + (ch - '0');
}
if (minus)
return -result;
else
return result;
}
int main()
{
int n,k;
n=readInt();
k=readInt();
int cnt=0;
while(n--)
{
int num;
num=readInt();
if(num%k==0)cnt++;
}
printf("%d",cnt);
return 0;
}