Luo Gu P1781 universe president

https://www.luogu.org/problem/P1781

#include<bits/stdc++.h>
using namespace std;
int main() {
    int n,bianhao=-1;    
    string a,piao="0";    
    cin>>n;
    for(int k=1; k<=n; k++) {
        cin>>a;
        if(a.length()>piao.length()||(a.length()==piao.length())&&(a>piao)) {   
            piao = a;    
            bianhao = K;
        }
    }
    cout<<bianhao<<endl<<piao;
}
// First compare the median, then the median of different size than the direct
// direct output ratio can not be normal size, it is spread? ?
 

 

Guess you like

Origin www.cnblogs.com/QingyuYYYYY/p/11704947.html