結果

問題 No.145 yukiover
ユーザー ctyl_0ctyl_0
提出日時 2015-09-06 04:12:12
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 5 ms / 5,000 ms
コード長 1,853 bytes
コンパイル時間 619 ms
コンパイル使用メモリ 79,160 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-26 09:18:32
合計ジャッジ時間 2,062 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;

using namespace std;


int inputValue(){
    int a;
    cin >> a;
    return a;
};

void inputArray(int * p, int a){
    rep(i, a){
        cin >> p[i];
    }
};

void inputVector(vector<int> * p, int a){
    rep(i, a){
        int input;
        cin >> input;
        p -> push_back(input);
    }
}

template <typename T>
void output(T a, int precision) {
    if(precision > 0){
        cout << setprecision(precision)  << a << "\n";
    }
    else{
        cout << a << "\n";
    }
}

int main(int argc, const char * argv[]) {
    
    // source code
    int N = inputValue();
    string s;
    cin >> s;
    int ah = 0;
    int i = 0;
    int j = 0;
    int k = 0;
    int lt = 0;
    int u = 0;
    int vx = 0;
    int y = 0;
    int z = 0;
    
    rep(a, N){
        if (s[a] == 'z') z++;
        else if (s[a] == 'y') y++;
        else if (s[a] >= 'v') vx++;
        else if (s[a] == 'u') u++;
        else if (s[a] >= 'l') lt++;
        else if (s[a] == 'k') k++;
        else if (s[a] == 'j') j++;
        else if (s[a] == 'i') i++;
        else ah++;
    }
    
    int ret = 0;
    
    while (y && u && k && i && ah) ret++, y--, u--, k--, i--, ah--;
    while (y && u && k && i >= 2) ret++, y--, u--, k--, i--, i--;
    while (y && u && k && j) ret++, y--, u--, k--, j--;
    while (y && u && k >= 2) ret++, y--, u--, k--, k--;
    while (y && u && lt) ret++, y--, u--, lt--;
    while (y && u >= 2) ret++, y--, u--, u--;
    while (y && vx) ret++, y--, vx--;
    while (y >= 2) ret++, y--, y--;
    while (z) ret++, z--;
    
    output(ret, 0);
    
    
    return 0;
}
0