[ABC381A]错一测试点,调试无果
  • 板块学术版
  • 楼主zzhengxi
  • 当前回复2
  • 已保存回复2
  • 发布时间2024/11/27 21:02
  • 上次更新2024/11/27 22:47:01
查看原帖
[ABC381A]错一测试点,调试无果
1279423
zzhengxi楼主2024/11/27 21:02

题目传送门

代码来啦

#include <bits/stdc++.h>
using namespace std;

int n;
string s;

bool flag(){
    if(n % 2 == 0) return false;
    int x = (1 + n) / 2 - 1;
    if(s[x] != '/') return false;
    for(int i = 1 ; i < x ; i ++)
        if(s[i] != '1') return false;
    for(int i = x + 1 ; i < n ; i ++)
        if(s[i] != '2') return false;
    return true;
}

int main(){
    cin >> n >> s;
    if(flag()) cout << "Yes";
    else cout << "No";
    return 0;
}

附上新鲜的翻译

2024/11/27 21:02
加载中...