結果

問題 No.1943 消えたAGCT(1)
ユーザー pitPpitP
提出日時 2022-05-21 00:08:34
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 124 ms / 2,000 ms
コード長 493 bytes
コンパイル時間 1,909 ms
コンパイル使用メモリ 81,484 KB
実行使用メモリ 76,804 KB
最終ジャッジ日時 2023-10-20 15:03:27
合計ジャッジ時間 3,590 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,396 KB
testcase_01 AC 38 ms
53,396 KB
testcase_02 AC 39 ms
53,396 KB
testcase_03 AC 39 ms
53,396 KB
testcase_04 AC 39 ms
53,396 KB
testcase_05 AC 39 ms
53,396 KB
testcase_06 AC 39 ms
53,396 KB
testcase_07 AC 38 ms
53,396 KB
testcase_08 AC 39 ms
53,396 KB
testcase_09 AC 73 ms
67,768 KB
testcase_10 AC 59 ms
63,488 KB
testcase_11 AC 59 ms
63,484 KB
testcase_12 AC 72 ms
63,512 KB
testcase_13 AC 56 ms
62,724 KB
testcase_14 AC 58 ms
66,100 KB
testcase_15 AC 111 ms
76,668 KB
testcase_16 AC 107 ms
76,804 KB
testcase_17 AC 109 ms
76,712 KB
testcase_18 AC 107 ms
76,796 KB
testcase_19 AC 109 ms
76,796 KB
testcase_20 AC 111 ms
76,792 KB
testcase_21 AC 115 ms
76,796 KB
testcase_22 AC 124 ms
76,796 KB
testcase_23 AC 104 ms
74,624 KB
testcase_24 AC 58 ms
63,484 KB
testcase_25 AC 57 ms
63,484 KB
testcase_26 AC 58 ms
63,488 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
s = "#" + input()
c = 0
for i in range(n+1):
    if s[i] in ["A","C","G","T"]:
        c += 1

if c == 0:
    print(0)
    exit()

idx = c
ans = 0
while c:
    if s[idx] not in ["A","C","G","T"]:
        idx += 1
        ans += 1
    else:
        idx += 1
        c -= 1
        ans += 1
        while c:
            if s[c] not in ["A","C","G","T"]:
                ans += 1
                break
            else:
                c -= 1
                ans += 1

print(ans)
0