forked from ndb796/python-for-coding-test
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path2.java
More file actions
31 lines (24 loc) Β· 828 Bytes
/
2.java
File metadata and controls
31 lines (24 loc) Β· 828 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
import java.util.*;
public class Main {
// νΉμ ν μκ° μμ '3'μ΄ ν¬ν¨λμ΄ μλμ§μ μ¬λΆ
public static boolean 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;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// Hλ₯Ό μ
λ ₯λ°κΈ°
int h = sc.nextInt();
int cnt = 0;
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++;
}
}
}
System.out.println(cnt);
}
}