結果
| 問題 |
No.145 yukiover
|
| コンテスト | |
| ユーザー |
古寺いろは
|
| 提出日時 | 2015-04-04 06:41:01 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,226 bytes |
| コンパイル時間 | 1,220 ms |
| コンパイル使用メモリ | 161,908 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-04 01:41:41 |
| 合計ジャッジ時間 | 1,979 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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 <= 'i' - 'a'; 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 <= 'k' - 'a'; 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 <= 'u' - 'a'; 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 <= 'y' - 'a'; 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;
}
古寺いろは