提出 #49699072


ソースコード 拡げる

#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <string>

#include <cmath>
#include <queue>
#include <stack>

#include <unordered_set>
#include <unordered_map>
#include <array>
#include <iomanip>

#include <atcoder/all>

using namespace std;

#define LL long long

inline int read() {
    int x = 0, f = 1;
    char c = getchar();
    while (c < '0' || c > '9') {
        if (c == '-') {
            f = -1;
        }
        c = getchar();
    }
    while (c >= '0' && c <= '9') {
        x = x * 10 + c - '0';
        c = getchar();
    }
    return x * f;
}

inline void write(int x) {
	if (x < 0) {
		putchar('-'); x = -x;
	}
    static int sta[35];
    int top = 0;
    do {
        sta[top++] = x % 10, x /= 10;
    } while (x);
    while (top) putchar(sta[--top] + 48); 
}

inline void writeln(int x) {
	if (x < 0) {
		putchar('-'); x = -x;
	}
    static int sta[35];
    int top = 0;
    do {
        sta[top++] = x % 10, x /= 10;
    } while (x);
    while (top) putchar(sta[--top] + 48); 
	putchar('\n');
}

inline LL readll() {
    LL x = 0, f = 1;
    char c = getchar();
    while (c < '0' || c > '9') {
        if (c == '-') {
            f = -1;
        }
        c = getchar();
    }
    while (c >= '0' && c <= '9') {
        x = x * 10 + c - '0';
        c = getchar();
    }
    return x * f;
}

inline void writell(LL x) {
	if (x < 0) {
		putchar('-'); x = -x;
	}
    static LL sta[35];
    int top = 0;
    do {
        sta[top++] = x % 10, x /= 10;
    } while (x);
    while (top) putchar(sta[--top] + 48); 
}

inline void writellln(LL x) {
	if (x < 0) {
		putchar('-'); x = -x;
	}
    static LL sta[35];
    int top = 0;
    do {
        sta[top++] = x % 10, x /= 10;
    } while (x);
    while (top) putchar(sta[--top] + 48); 
	putchar('\n');
}
template<class DataType1, class DataType2>
void write(pair<DataType1, DataType2> a, char endSplit = ' ') {
    cout << "(" << a.first << ", " << a.second << ")" << endSplit;
}
template<class DataType>
void write(vector<DataType> &a, char split = ' ', char endSplit = '\n') {
    for (int i = 0; i < a.size(); ++i) {
        cout << a[i] << split;
    }
    cout << endSplit;
}

using mint = atcoder::modint998244353;

int main() {
	// std::ios::sync_with_stdio(false);
    // std::cin.tie(0);
    string s;
    cin >> s;
    vector<int> cnt(26, 0);
    for (int i = 0; i < s.length(); ++i) {
        cnt[s[i] - 'a'] += 1;
    }
    int mv = 0, mc = -1;
    for (int i = 0; i < 26; ++i) {
        if (cnt[i] > mv) {
            mv = cnt[i]; mc = i;
        }
    }
    cout << char('a' + mc) << endl;
	return 0;
}

提出情報

提出日時
問題 B - Frequency
ユーザ AliceNan
言語 C++ 20 (gcc 12.2)
得点 200
コード長 2845 Byte
結果 AC
実行時間 1 ms
メモリ 3692 KiB

コンパイルエラー

Main.cpp: In function ‘int main()’:
Main.cpp:128:23: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
  128 |     for (int i = 0; i < s.length(); ++i) {
      |                     ~~^~~~~~~~~~~~

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 200 / 200
結果
AC × 3
AC × 11
セット名 テストケース
Sample 01-sample.txt, 02-sample.txt, 03-sample.txt
All 01-sample.txt, 02-sample.txt, 03-sample.txt, 04-hidden.txt, 05-hidden.txt, 06-hidden.txt, 07-hidden.txt, 08-hidden.txt, 09-hidden.txt, 10-hidden.txt, 11-hidden.txt
ケース名 結果 実行時間 メモリ
01-sample.txt AC 1 ms 3488 KiB
02-sample.txt AC 1 ms 3520 KiB
03-sample.txt AC 1 ms 3692 KiB
04-hidden.txt AC 1 ms 3380 KiB
05-hidden.txt AC 1 ms 3476 KiB
06-hidden.txt AC 1 ms 3500 KiB
07-hidden.txt AC 1 ms 3480 KiB
08-hidden.txt AC 1 ms 3496 KiB
09-hidden.txt AC 1 ms 3464 KiB
10-hidden.txt AC 1 ms 3528 KiB
11-hidden.txt AC 1 ms 3528 KiB