正文
增加 7 行删除 7 行
22 行未改动2324252627282930313233343536373839404142434445464748495051526 行未改动22 行未改动signed main(){ios::sync_with_stdio(false);cin.tie(0), cout.tie(0);cin >> n >> m;for(int i = 0; i < n; i++){cin >> a[i];}int ans = 0;for(int i = 0; i < m; i++){ //枚举每一位memset(cnt, 0, sizeof(cnt)); //不要忘了初始化for(int j = 0; j < n; j++){ //统计该位各字符出现次数cnt[a[j][i] - 'a']++;}int mmax = 0;for(int k = 0; k < 26; k++){mmax = max(mmax, cnt[k]);}ans += n - mmax; //该位最少的修改次数}cout << ans;return 0;}6 行未改动22 行未改动2324252627282930313233343536373839404142434445464748495051526 行未改动22 行未改动signed main(){ios::sync_with_stdio(false);cin.tie(0), cout.tie(0);cin >> n >> m;for(int i = 0; i < n; i++){cin >> a[i];}int ans = 0;for(int i = 0; i < m; i++){ //枚举每一位memset(cnt, 0, sizeof(cnt)); //不要忘了初始化for(int j = 0; j < n; j++){ //统计该位各字符出现次数cnt[a[j][i] - 'a']++;}int mmax = 0;for(int k = 0; k < 26; k++){mmax = max(mmax, cnt[k]);}ans += n - mmax; //该位最少的修改次数}cout << ans;return 0;}6 行未改动