-
Notifications
You must be signed in to change notification settings - Fork 0
/
1014.c
65 lines (59 loc) · 1.3 KB
/
1014.c
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
57
58
59
60
61
62
63
64
65
#include<stdio.h>
#include<ctype.h>
int main()
{
int i;
int flag = 0;
int m = 0;
int d = 0;
int h = 0;
char day[7][5] = {"MON\0","TUE\0","WED\0","THU\0","FRI\0","SAT\0","SUN\0"};
char str1[60];
char str2[60];
char str3[60];
char str4[60];
scanf("%s",str1);
scanf("%s",str2);
scanf("%s",str3);
scanf("%s",str4);
for(i = 0;str1[i] != '\0';i++)
{
if(str1[i] == str2[i])
{
if(flag == 0)
{
if(str1[i] <= 'G' && str1[i] >= 'A')
{
d =(int)str1[i] - 'A';
flag++;
}
}
else if(flag == 1)
{
if(str1[i] <= '9' && str1[i] >= '0')
{
h = (int)str1[i] - '0';
break;
}
if(str1[i] <= 'N' && str1[i] >= 'A')
{
h = (int)str1[i] - 'A' + 10;
break;
}
}
}
}
for(i = 0;str3[i] != '\0';i++)
{
if(str3[i] == str4[i])
{
if(isalpha(str3[i]))
{
m = i;
break;
}
}
}
printf("%s %02d:%02d",day[d],h,m);
return 0;
}