-
Notifications
You must be signed in to change notification settings - Fork 0
/
A1061.cpp
67 lines (60 loc) · 1.03 KB
/
A1061.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
57
58
59
60
61
62
63
64
65
66
67
#include<iostream>
#include<cstring>
using namespace std;
string week[7] = {"MON","TUE","WED","THU","FRI","SAT","SUN"};
const int SIZE = 60;
int main(){
char str1[65];
char str2[65];
scanf("%s %s",&str1,&str2);
int i=0;
int j=0;
while((i<strlen(str1))&&(j<strlen(str2))){
if(str1[i] == str2[j]){
cout<<week[str1[i]-'A']<<" ";
i++;
j++;
break;
}
i++;
j++;
}
//Êä³öСʱ
while((i<strlen(str1))&&(j<strlen(str2))){
if(str1[i] == str2[j]){
if(str1[i]>='0' && str1[i]<='9'){
printf("%d:",str1[i]-'0');
break;
}
else if(str1[i]>='A' && str1[i]<='N'){
printf("%d:",str1[i]-'A'+10);
break;
}
}
else{
i++;
j++;
}
}
//Êä³öʱ¼ä
scanf("%s %s",&str1,&str2);
int cts =0;
i=0;
j=0;
while((i<strlen(str1))&&(j<strlen(str2))){
cts++;
if(str1[i]==str2[j]){
break;
}
i++;
j++;
}
if(cts<10){
printf("0%d",cts);
}
else{
printf("%d",cts);
}
//Êä³ö
return 0;
}