- Notifications
You must be signed in to change notification settings - Fork 846
/
Copy path2.cpp
27 lines (23 loc) · 657 Bytes
/
2.cpp
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
#include<bits/stdc++.h>
usingnamespacestd;
int h, cnt;
// 특정한 시각 안에 '3'이 포함되어 있는지의 여부
boolcheck(int h, int m, int s) {
if (h % 10 == 3 || m / 10 == 3 || m % 10 == 3 || s / 10 == 3 || s % 10 == 3)
returntrue;
returnfalse;
}
intmain(void) {
// H를 입력받기
cin >> h;
for (int i = 0; i <= h; i++) {
for (int j = 0; j < 60; j++) {
for (int k = 0; k < 60; k++) {
// 매 시각 안에 '3'이 포함되어 있다면 카운트 증가
if (check(i, j, k)) cnt++;
}
}
}
cout << cnt << '\n';
return0;
}