B1061 Dating (模拟)
2020-01-23 本文已影响0人
Tsukinousag
B1061 Dating (20分)
这题拿满分题目必须仔细 !而且是指定的字母范围。
//第一个相同的大写字母[A,G],接着之后有第二个相同的[0,9]或者[A,N]的字符
//有相同的英文字符返回位置(不区分大小写)
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string.h>
#include <cmath>
#include <math.h>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <stack>
using namespace std;
typedef long long ll;
const int MAX=100005;
const int INF=0x3f3f3f3f;
const int mod=1000000007;
char mpday[10][10]={"MON","TUE","WED","THU","FRI","SAT","SUN"};
int main()
{
int t1,t2=0,t3=0;
string s1,s2,s3,s4;
cin>>s1>>s2>>s3>>s4;
int minlen=min(s1.size(),s2.size());
for(int i=0;i<minlen;i++)
{
if(s1[i]>='A'&&s1[i]<='G')
{
if(s1[i]==s2[i])
{
t1=i;
break;
}
}
}
cout<<mpday[s1[t1]-'A']<<" ";
for(int i=t1+1;i<minlen;i++)
{
if((s1[i]>='A'&&s1[i]<='N')||(s1[i]>='0'&&s1[i]<='9'))
{
if(s1[i]==s2[i])
{
t2=i;
break;
}
}
}
if(s1[t2]>='A'&&s1[t2]<='Z')
printf("%02d:",s1[t2]-'A'+10);
else if(s1[t2]>='0'&&s1[t2]<='9')
printf("%02d:",s1[t2]-'0');
int minlen2=min(s3.size(),s4.size());
for(int i=0;i<minlen2;i++)
{
if((s3[i]>='A'&&s3[i]<='Z')||(s3[i]>='a'&&s3[i]<='z'))
{
if(s3[i]==s4[i])
{
t3=i;
break;
}
}
}
printf("%02d\n",t3);
return 0;
}