保龄求调QAQ
查看原帖
保龄求调QAQ
1705395
Victor_Wayne楼主2025/7/20 17:01
#include <bits/stdc++.h>
using namespace std;
int n,a[2222];
stack <int> s;
int main(){
    while(cin>>n){
        while(!s.empty())s.pop();
        for(int i=1;i<=n;i++){
            cin>>a[i];
        }
        s.push(a[1]);
        for(int i=2;i<=n;i++){
            if(a[i]<s.top()){
                s.pop();
                s.push(a[i]);
            }else if(a[i]>s.top()){
                s.push(a[i]);
            }
        }
        if(s.size()>=n/2){
            cout<<"Yes!\n";
        }else{
            cout<<"No!\n";
        }
    }
    
    return 0;
}
2025/7/20 17:01
加载中...