結果

問題 No.145 yukiover
ユーザー mayoko_mayoko_
提出日時 2015-02-06 01:16:03
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 5 ms / 5,000 ms
コード長 1,411 bytes
コンパイル時間 531 ms
コンパイル使用メモリ 74,664 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-05 14:14:00
合計ジャッジ時間 1,631 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,384 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 4 ms
4,380 KB
testcase_12 AC 5 ms
4,376 KB
testcase_13 AC 5 ms
4,376 KB
testcase_14 AC 5 ms
4,380 KB
testcase_15 AC 4 ms
4,380 KB
testcase_16 AC 3 ms
4,376 KB
testcase_17 AC 5 ms
4,376 KB
testcase_18 AC 5 ms
4,376 KB
testcase_19 AC 5 ms
4,376 KB
testcase_20 AC 5 ms
4,376 KB
testcase_21 AC 5 ms
4,376 KB
testcase_22 AC 5 ms
4,380 KB
testcase_23 AC 5 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>

#define INF 1000000000

using namespace std;
typedef long long ll;

int main(void) {
    int z = 0, y = 0, v = 0, u = 0, l = 0, k = 0, j = 0, i = 0, a = 0;
    int N;
    string s;
    cin >> N;
    cin >> s;
    for (int p = 0; p < N; p++) {
        if (s[p] == 'z') z++;
        else if (s[p] == 'y') y++;
        else if (s[p] > 'u') v++;
        else if (s[p] == 'u') u++;
        else if (s[p] > 'k') l++;
        else if (s[p] == 'k') k++;
        else if (s[p] > 'i') j++;
        else if (s[p] == 'i') i++;
        else a++;
    }
    int ans = 0;
    while (y && u && k && i && a) {
        y--; u--; k--; i--; a--; ans++;
    }
    while (y && u && k && i >= 2) {
        y--; u--; k--; i-=2; ans++;
    }
    while (y && u && k && j) {
        y--; u--; k--; j--; ans++;
    }
    while (y && u && k >= 2) {
        y--; u--; k-=2; ans++;
    }
    while (y && u && l) {
        y--; u--; l--; ans++;
    }
    while (y && u >= 2) {
        y--; u-=2; ans++;
    }
    while (y && v) {
        y--; v--; ans++;
    }
    while (y >= 2) {
        y-=2; ans++;
    }
    while (z) {
        z--; ans++;
    }
    cout << ans << endl;
    return 0;
}
0