結果

問題 No.423 ハムスター語初級(数詞)
ユーザー 夜
提出日時 2020-08-08 12:15:11
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,114 bytes
コンパイル時間 2,314 ms
コンパイル使用メモリ 97,264 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-07-24 17:41:36
合計ジャッジ時間 1,689 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 WA -
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
int main() {
    string s;
    cin >> s;
    bitset<20> bit;
    int co = 0;
    for (int i = s.size() - 1; i >= 0;) {
        if (s[i] == 'u') {
            bit[co] = 1;
            i -= 4;
            co++;
            continue;
        }
        else {
            bit[co] = 0;
            i -= 3;
            co++;
            continue;
        }
    }
    long long a = bit.to_ulong();
    a *= 2;
    bit = a;
    stack<string> que;
    for (int i = 0; i < 20; i++) {
        if (bit[i]) {
            que.push("hamu");
        }
        else {
            que.push("ham");
        }
    }
    bool b = false;
    while (!que.empty()) {
        if (que.top() == "hamu") {
            b = true;
        }
        if (b) {
            cout << que.top();
        }
        que.pop();
    }
    cout << endl;
    return 0;
}
0