提出 #27596768


ソースコード 拡げる

#include <bits/stdc++.h>
using namespace std;

int main(){
    string S;
    cin >> S;
    string ans;
    int N = S.length();
    for(int i = 0; i < N; i++){
        ans += S[i];
        if(ans.size() >= 2){
            string t = ans.substr(ans.size() - 2, 2);
            if(t == "ST") for(int j = 0; j < 2; j++) ans.pop_back();
        }
    }

    cout << (int)ans.size() << endl;
    return 0;
}

提出情報

提出日時
問題 A - STring
ユーザ macle
言語 C++ (GCC 9.2.1)
得点 300
コード長 419 Byte
結果 AC
実行時間 15 ms
メモリ 3736 KiB

ジャッジ結果

セット名 Sample Subtask1 All
得点 / 配点 0 / 0 200 / 200 100 / 100
結果
AC × 3
AC × 9
AC × 13
セット名 テストケース
Sample example0, example1, example2
Subtask1 example0, example1, example2, sub_corner0, sub_corner1, sub_corner2, sub_rand0, handmade0, handmade1
All corner0, corner1, corner2, example0, example1, example2, handmade0, handmade1, maxrand0, sub_corner0, sub_corner1, sub_corner2, sub_rand0
ケース名 結果 実行時間 メモリ
corner0 AC 14 ms 3656 KiB
corner1 AC 15 ms 3716 KiB
corner2 AC 15 ms 3664 KiB
example0 AC 3 ms 3524 KiB
example1 AC 2 ms 3516 KiB
example2 AC 3 ms 3448 KiB
handmade0 AC 2 ms 3608 KiB
handmade1 AC 3 ms 3512 KiB
maxrand0 AC 15 ms 3736 KiB
sub_corner0 AC 2 ms 3540 KiB
sub_corner1 AC 2 ms 3588 KiB
sub_corner2 AC 2 ms 3612 KiB
sub_rand0 AC 2 ms 3528 KiB