20分求助

P1781 宇宙总统

票数很大可能会超过 $100$ 位数字。。。
by metrixgo_caozhendi @ 2023-12-23 11:04:50


你改成用 string 输入
by metrixgo_caozhendi @ 2023-12-23 11:05:51


你只过了样例啊
by 2022_37_yzyUUU @ 2023-12-23 11:07:19


@[metrixgo_caozhendi](/user/1009345) string 输入怎么输入???
by ZBXALQX @ 2023-12-23 11:19:55


@[metrixgo_caozhendi](/user/1009345) (提醒)
by ZBXALQX @ 2023-12-23 11:40:17


@[ZBXALQX](/user/1070547) 就是定义一个 string 然后 cin 就行了
by metrixgo_caozhendi @ 2023-12-23 12:40:27


@[metrixgo_caozhendi](/user/1009345) 能不能给个代码???
by ZBXALQX @ 2023-12-23 13:11:36


@[metrixgo_caozhendi](/user/1009345) (提醒)X2
by ZBXALQX @ 2023-12-23 13:39:20


@[ZBXALQX](/user/1070547) ```cpp #include<bits/stdc++.h> using namespace std; int n,k; string s,maxx="0"; bool cmp(string a,string b) { if(a.size()==b.size()) return a>b; return a.size()>b.size(); } int main() { cin>>n; for(int i=1;i<=n;i++) { cin>>s; if(cmp(s,maxx)) maxx=s,k=i; } cout<<k<<endl<<maxx; return 0; } ``` cmp 是比较字符串大小的
by metrixgo_caozhendi @ 2023-12-23 15:12:31


@[metrixgo_caozhendi](/user/1009345) 谢谢,此贴终
by ZBXALQX @ 2023-12-23 15:14:16


|