Блог пользователя optimize_ofast

Автор optimize_ofast, история, 9 месяцев назад, По-английски

This question is quite easy!

We only need to input t sets of data and traverse each string. And use two counters, "suma" and "sumb", to determine the number of occurrences of letter A and letter B, and compare them.

It is worth noting that the title has already mentioned that the length of the string is 5, so we do not need to determine whether suma is equal to sumb.

Hope to see your comments!

Below is the AC code:

#include <bits/stdc++.h>
using namespace std;

int t;
int main() {
	cin >> t;
	while(t--) {
		string s;
		cin >> s;
		int suma = 0, sumb = 0;
		for(int i = 0; i < s.length(); i++) {
			if(s[i] == 'A') suma++;
			else sumb++;
		}
		if(suma > sumb) cout << "A" << endl;
		else cout << "B" << endl;
	}
	return 0;
}
  • Проголосовать: нравится
  • -5
  • Проголосовать: не нравится

»
9 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

I think some of the problems of "Codeforces Round Div.4" are a little difficult to me.

What should I do?

»
9 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

yes but who asked

»
9 месяцев назад, # |
  Проголосовать: нравится +21 Проголосовать: не нравится

I mean your effort is fine, but people don't really need extra blog editorial for these simple problems, they'd just look fot the official ones right?

Publish editorial only when it's official editorial is not published or you have something really unique to add. Don't add editorial for very simple problems either.