CodeForces 1873A Short Sort

题目链接: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;
}
posted @ 2024-08-01 15:45  薛定谔的AC  阅读(2)  评论(0编辑  收藏  举报