結果

問題 No.1943 消えたAGCT(1)
ユーザー moon17
提出日時 2022-05-20 22:34:53
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 581 bytes
コンパイル時間 120 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 38,576 KB
最終ジャッジ日時 2024-09-20 08:51:04
合計ジャッジ時間 3,941 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 9 TLE * 1 -- * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
S = input()

ans=0
#c=S.count("A")+S.count("G")+S.count("C")+S.count("T")

pos=[]
c=0
for i in range(N):
    if S[i]=="A" or S[i]=="G" or S[i]=="C" or S[i]=="T":
        pos.append(i)
        c+=1

if c>0:
    ans=0
    kesu=c-1
    moto=c-1
    next=c-1
    for i in range(N):
#        print(next)
        ans+=1
        if next in pos:
            moto-=1
            next=moto
            if moto<0:
                break
        else:
            kesu+=1
            next=kesu
            if kesu>(N-1):
                break
    print(ans)

else:
    print(0)
0