提出 #12894206


ソースコード 拡げる

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
            ∧_∧
      ∧_∧  (´<_` )  Welcome to My Coding Space!
     ( ´_ゝ`) /  ⌒i     @hamayanhamayan0
    /   \     | |
    /   / ̄ ̄ ̄ ̄/  |
  __(__ニつ/     _/ .| .|____
     \/____/ (u ⊃
---------------------------------------------------------------------------------------------------*/














string S;
int cnt[3];
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> S;
	fore(c, S) cnt[c - 'a']++;

	int ma = -1;
	rep(i, 0, 3) chmax(ma, cnt[i]);
	rep(i, 0, 3) if (ma == cnt[i]) cout << char('a' + i) << endl;
}





提出情報

提出日時
問題 B - 多数決
ユーザ hamayanhamayan
言語 C++ (GCC 9.2.1)
得点 8
コード長 1589 Byte
結果 AC
実行時間 3 ms
メモリ 3684 KiB

ジャッジ結果

セット名 All
得点 / 配点 8 / 8
結果
AC × 24
セット名 テストケース
All 0.txt, 1.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 2.txt, 3.txt, 4.txt, 5.txt, 6.txt, 7.txt, 8.txt, 9.txt, s1.txt, s2.txt, s3.txt, s4.txt
ケース名 結果 実行時間 メモリ
0.txt AC 3 ms 3684 KiB
1.txt AC 2 ms 3628 KiB
10.txt AC 2 ms 3608 KiB
11.txt AC 2 ms 3560 KiB
12.txt AC 2 ms 3504 KiB
13.txt AC 2 ms 3584 KiB
14.txt AC 2 ms 3532 KiB
15.txt AC 2 ms 3532 KiB
16.txt AC 2 ms 3628 KiB
17.txt AC 2 ms 3668 KiB
18.txt AC 2 ms 3628 KiB
19.txt AC 2 ms 3508 KiB
2.txt AC 2 ms 3508 KiB
3.txt AC 2 ms 3548 KiB
4.txt AC 2 ms 3556 KiB
5.txt AC 2 ms 3584 KiB
6.txt AC 2 ms 3536 KiB
7.txt AC 2 ms 3596 KiB
8.txt AC 2 ms 3556 KiB
9.txt AC 2 ms 3488 KiB
s1.txt AC 2 ms 3616 KiB
s2.txt AC 2 ms 3536 KiB
s3.txt AC 2 ms 3596 KiB
s4.txt AC 2 ms 3488 KiB