InTheBloodHorse

每日一题(45) codeforces 1097A

字数统计: 116阅读时长: 1 min
2019/01/07 Share

题目地址

题意

给一个目标字符串AB,接下来给五个字符串XY,假如X=A || Y=B输出YES

AC代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include<bits/stdc++.h>
using namespace std;
map<char,int>m1;
map<char,int>m2;
int main()
{
string ans = "NO";
string need;
cin >> need;
string ff;
m1[need[0]] = 1;
m2[need[1]] = 1;
for(int i=0;i<5;i++){
cin >> ff;
if(m1[ff[0]] == 1) ans="YES";
if(m2[ff[1]] == 1) ans="YES";
}
cout << ans << endl;
}

原文作者:InTheBloodHorse

原文链接:http://pyking.cn/2019/01/07/每日一题-45-codeforces-1097A/

发表日期:January 7th 2019, 4:15:23 pm

更新日期:January 7th 2019, 4:25:14 pm

版权声明:Have a fun

CATALOG
  1. 1. 题意