-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathB1014.cpp
47 lines (45 loc) · 1.37 KB
/
B1014.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
/*
* hint:
* 1. 不要吝啬大括号!不要吝啬大括号!不要吝啬大括号!
* 2. 不要在语法上找捷径!这是算法题,不是语法题!
* 3. 及时转变思路,重写代码!
*/
#include <iostream>
#include <cstring>
#define MAXN 70
using namespace std;
int main()
{
char s1[MAXN], s2[MAXN], s3[MAXN], s4[MAXN], weekday[7][5] = {"MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"};
scanf("%s\n%s\n%s\n%s", s1, s2, s3, s4);
int pos, len = min(strlen(s1), strlen(s2));
for (pos = 0; pos < len; pos++)
if (s1[pos] == s2[pos] && 'A' <= s1[pos] && s1[pos] <= 'G')
{
printf("%s ", weekday[s1[pos]-'A']);
break;
}
for (pos++; pos < len; pos++)
if (s1[pos] == s2[pos])
{
if ('0' <= s1[pos] && s1[pos] <= '9')
{
printf("%02d:", s1[pos] - '0');
break;
}
else if ('A' <= s1[pos] && s1[pos] <= 'N')
{
printf("%02d:", s1[pos] - 'A' + 10);
break;
}
}
len = min(strlen(s3), strlen(s4));
for (pos = 0; pos < len; pos++)
if (s3[pos] == s4[pos])
if (('a' <= s3[pos] && s3[pos] <= 'z') || ('A' <= s3[pos] && s3[pos] <= 'Z'))
{
printf("%02d\n", pos);
break;
}
return 0;
}