結果

問題 No.154 市バス
ユーザー 小指が強い人
提出日時 2015-11-23 17:03:28
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 569 bytes
コンパイル時間 441 ms
コンパイル使用メモリ 56,820 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-13 07:50:18
合計ジャッジ時間 1,161 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other AC * 5 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
using namespace std;

int main(void)
{
    int t;
    cin >> t;
    for(int i = 0; i < t; i++)
    {
        string str;
        int stack = 0;
        cin >> str;
        for(int j = 0; j < str.size(); j++)
        {
            if(str[j] == 'G')
                stack++;
            else if(str[j] == 'R')
                stack--;
            if(stack < 0)
                break;
        }
        if(stack == 0)
            cout << "possible" << endl;
        else
            cout << "impossible" << endl;
    }
    return 0;
}
0