2019-11-24
14:57:51
比较100位的数字,属于高精度。直接上字符串
#include<bits/stdc++.h> #define f(a,b,c) for(int a=b;a<=c;a++) #define f1(a,b,c) for(int a=b;a>=c;i--) using namespace std; bool cmp(pair<int,string> a,pair<int,string> b){ if(a.second.size() != b.second.size()){ return a.second.size() > b.second.size(); }else return a.second>b.second; } int main(){ pair<int,string> t[21]; int n; cin>>n; f(i,1,n) cin>>t[i].second,t[i].first = i; sort(t+1,t+n+1,cmp); cout<<t[1].first<<" "<<t[1].second; return 0; }