forked from ndb796/python-for-coding-test
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path2.cpp
More file actions
27 lines (23 loc) Β· 657 Bytes
/
2.cpp
File metadata and controls
27 lines (23 loc) Β· 657 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
#include <bits/stdc++.h>
using namespace std;
int h, cnt;
// νΉμ ν μκ° μμ '3'μ΄ ν¬ν¨λμ΄ μλμ§μ μ¬λΆ
bool check(int h, int m, int s) {
if (h % 10 == 3 || m / 10 == 3 || m % 10 == 3 || s / 10 == 3 || s % 10 == 3)
return true;
return false;
}
int main(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';
return 0;
}