結果

問題 No.2997 Making YuzuKizu
ユーザー t98slider
提出日時 2024-12-22 00:04:59
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 589 bytes
コンパイル時間 2,157 ms
コンパイル使用メモリ 196,784 KB
最終ジャッジ日時 2025-02-26 16:04:10
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    array<int, 26> cnt{};
    for(auto &&c : s){
        cnt[c - 'a']++;
    }
    vector<string> a = {"yukari", "akari", "yuzukizu"};
    for(int i = 0; i < 3; i++){
        array<int, 26> cnt2{};
        for(auto &&c : a[i]) cnt2[c - 'a']++;
        int mn = s.size();
        for(int i = 0; i < 26; i++){
            if(cnt2[i] == 0) continue;
            mn = min(mn, cnt[i] / cnt2[i]);
        }
        cout << mn << (i == 2 ? '\n' : ' ');
    }
}
0