ABC192 B-uNrEaDaBlE sTrInG (analog)

Title:

Insert picture description here

solution:

模拟即可.
从左到右遍历直接判断每个位置是否符合题目条件.

code:

#include<bits/stdc++.h>
using namespace std;
const int maxm=2e6+5;
char s[maxm];
int n;
void solve(){
    
    
    cin>>(s+1);
    n=strlen(s+1);
    int ok=1;
    for(int i=1;i<=n&&ok;i++){
    
    
        if(i%2){
    
    
            if(!islower(s[i])){
    
    
                ok=0;
            }
        }else{
    
    
            if(!isupper(s[i])){
    
    
                ok=0;
            }
        }
    }
    if(!ok)cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
}
signed main(){
    
    
    solve();
    return 0;
}

Guess you like

Origin blog.csdn.net/weixin_44178736/article/details/115151107