题目链接:CodeForces 1873A【Short Sort】
思路
签到题,因为能交换两个元素的位置,所以只需要判断是否有一个元素在他原来该在的位置上就行。
代码
#include <iostream>
#include <cstring>
using namespace std;
#define ll long long
const int N = 1e5 + 10;
void solve() {
string s;
cin >> s;
if (s[0] == 'a' || s[1] == 'b' || s[2] == 'c') {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
}
int main() {
int t;
cin >> t;
while (t--) {
solve();
}
return 0;
}
标签:Sort,Short,CodeForces,long,1873A,include
From: https://www.cnblogs.com/againss/p/18336830