結果

問題 No.725 木は明らかに森である
ユーザー __dAi00__dAi00
提出日時 2018-08-24 21:39:33
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,255 bytes
コンパイル時間 461 ms
コンパイル使用メモリ 52,524 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-05 11:13:54
合計ジャッジ時間 1,156 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>

using namespace std;

int main() {
    char S[200];
    char T[200];
    int state = 0;
    cin >> S;
    int ti = 0;
    for (int i=0; i<102; i++) {
        T[ti] = S[i];
        ti++;
        if (S[i] == 0) break;
        switch (S[i]) {
            case 't':
                state =1 ;
                break;
            case 'r':
                if (state == 1) state++;
                else state = 0;
                break;
            case 'e':
                if (state == 2 || state == 3) state++;
                else if (state == 6) {
                    T[ti-7] = 'f';
                    T[ti-6] = 'o';
                    T[ti-5] = 'r';
                    T[ti-4] = 'e';
                    T[ti-3] = 's';
                    T[ti-2] = 't';
                    ti = ti - 1;
                    state = 0;
                    break;
                } else {
                    state = 0;
                }
                break;
            case 'o':
                if (state == 4) state++;
                else state = 0;
                break;
            case 'n':
                if (state == 5) state++;
                else state = 0;
                break;
        }
    }
    cout << T << endl;
    return 0;
}
0