2 条题解
-
1
#include<bits/stdc++.h> using namespace std; int t; string s; int main(){ cin>>t; while(t--){ cin>>s; int ma=0,b[30]; for(int i=1;i<30;i++){ b[i]=0; } for(int i=0;i<s.size();i++){ b[s[i]-'a'+1]++; } for(int i=1;i<=26;i++){ ma=max(ma,b[i]); } int sy=s.size()-ma; if(ma>=sy){ cout<<ma-sy<<endl; }else{ cout<<s.size()%2<<endl; } } return 0; }
信息
- ID
- 4006
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 6
- 标签
- (无)
- 递交数
- 78
- 已通过
- 26
- 上传者