結果
問題 |
No.145 yukiover
|
ユーザー |
![]() |
提出日時 | 2015-04-04 06:39:27 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,194 bytes |
コンパイル時間 | 1,261 ms |
コンパイル使用メモリ | 160,768 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-04 01:41:38 |
合計ジャッジ時間 | 2,475 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 WA * 1 |
other | AC * 19 WA * 1 |
ソースコード
#include "bits/stdc++.h" using namespace std; int main() { vector<int> count(26); int N; cin >> N; string S; cin >> S; for (int i = 0; i < N; i++) { count[S[i] - 'a']++; } int ans = 0; for (int i = 0; i < 26; i++) { while (count['y' - 'a'] > 0 && count['u' - 'a'] > 0 && count['k' - 'a'] > 0 && count['i' - 'a'] > 0 && count[i] > 0){ count['y' - 'a']--; count['u' - 'a']--; count['k' - 'a']--; count['i' - 'a']--; count[i]--; ans++; } } for (int i = 'i' - 'a' + 1; i < 26; i++) { while (count['y' - 'a'] > 0 && count['u' - 'a'] > 0 && count['k' - 'a'] > 0 && count[i] > 0){ count['y' - 'a']--; count['u' - 'a']--; count['k' - 'a']--; count[i]--; ans++; } } for (int i = 'k' - 'a' + 1; i < 26; i++) { while (count['y' - 'a'] > 0 && count['u' - 'a'] > 0 && count[i] > 0){ count['y' - 'a']--; count['u' - 'a']--; count[i]--; ans++; } } for (int i = 'u' - 'a' + 1; i < 26; i++) { while (count['y' - 'a'] > 0 && count[i] > 0){ count['y' - 'a']--; count[i]--; ans++; } } for (int i = 'y' - 'a' + 1; i < 26; i++) { while (count[i] > 0){ count[i]--; ans++; } } cout << ans << endl; }