結果

問題 No.1943 消えたAGCT(1)
ユーザー mnmmnm
提出日時 2022-05-24 19:51:52
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 560 bytes
コンパイル時間 751 ms
コンパイル使用メモリ 74,548 KB
実行使用メモリ 4,372 KB
最終ジャッジ日時 2023-10-20 18:55:08
合計ジャッジ時間 19,042 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 17 ms
4,372 KB
testcase_10 AC 14 ms
4,372 KB
testcase_11 AC 13 ms
4,372 KB
testcase_12 TLE -
testcase_13 AC 501 ms
4,348 KB
testcase_14 AC 3 ms
4,348 KB
testcase_15 AC 1,796 ms
4,348 KB
testcase_16 AC 1,168 ms
4,348 KB
testcase_17 AC 1,332 ms
4,348 KB
testcase_18 TLE -
testcase_19 TLE -
testcase_20 TLE -
testcase_21 TLE -
testcase_22 AC 818 ms
4,372 KB
testcase_23 AC 833 ms
4,372 KB
testcase_24 AC 13 ms
4,372 KB
testcase_25 AC 14 ms
4,372 KB
testcase_26 AC 14 ms
4,372 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>

#define rep(i,n) for(i=0; i<n; ++i)
#define in(a) cin >> a
#define out(a,b) cout << a << b
using namespace std;
using lint = long long;

int main(void){
    int i, j, n, m, k, cnt = 0;
    string s, u="AGCT";
    char let;
    int c=0;
    in(n);
    in(s);
    rep(i,n){
        rep(j,4)    c+=s[i]==u[j];
    }
    while(c){
        cnt++;
        let = s[c-1];
        s.erase(c-1,1);
        rep(i,4)    c-=let==u[i];
    }
    out(cnt,endl);

    return 0;
}

0