-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2437.countTime.cpp
56 lines (54 loc) · 1.27 KB
/
2437.countTime.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
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
53
54
55
56
#include <bits/stdc++.h>
using namespace std;
class Solution {
public:
int countTime(string time) {
int b_res = 1;
if (time[3] == '?') {
b_res = b_res * 6;
}
if (time[4] == '?') {
b_res = b_res * 10;
}
int a_res = 1;
if (time[0] == '?') {
if (time[1] == '?') {
a_res = 24;
} else {
if (time[1] <= '3') {
a_res = 3;
} else {
a_res = 2;
}
}
} else {
if (time[0] == '0') {
if (time[1] == '?') {
a_res = 10;
} else {
a_res = 1;
}
}
if (time[0] == '1') {
if (time[1] == '?') {
a_res = 10;
} else {
a_res = 1;
}
}
if (time[0] == '2') {
if (time[1] == '?') {
a_res = 4;
} else {
a_res = 1;
}
}
}
return a_res * b_res;
}
};
int main() {
int a = Solution().countTime("0?:0?");
cout << a << endl;
return 0;
}