1 条题解
-
1
#include<bits/stdc++.h> using namespace std; //输入保证正确 //输出看仔细 //所有情况都测 //数组定义,保证正确 struct node{ int x; string y; }; bool cmp(node t,node h) { return t.x<h.x; } node a[100005]; int main() { int n; string t , s; cin>>n; int h=0; for(int i=1;i<=n;i++) { cin>>t; s=t[0]; for(int j=1;j<t.size();j++) { if(t[j]!=t[j-1]) s+=t[j]; } int f=-1; for(int j=1;j<=h;j++) { if(a[j].y==s) { f=j; break; } } if(f!=-1) a[f].x++; else { h++; a[h].y=s; a[h].x=1; } } sort(a+1,a+h+1,cmp); cout<<a[h].y; return 0; }
- 1
信息
- ID
- 448
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 2
- 标签
- 递交数
- 55
- 已通过
- 27
- 上传者