結果

問題 No.1943 消えたAGCT(1)
ユーザー rururun
提出日時 2024-11-15 12:28:12
言語 Swift
(6.0.3)
結果
AC  
実行時間 102 ms / 2,000 ms
コード長 383 bytes
コンパイル時間 1,440 ms
コンパイル使用メモリ 120,600 KB
実行使用メモリ 17,408 KB
最終ジャッジ日時 2024-11-15 12:28:28
合計ジャッジ時間 4,615 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 27
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.swift:1:11: warning: expression of type 'String' is unused
readLine()!
~~~~~~~~~~^

ソースコード

diff #

readLine()!
let s = readLine()!.map{String($0)}
let As: Set<String> = ["A","G","C","T"]
var c = 0
for i in s{
    if As.contains(i){
        c += 1
    }
}
var k = c, cnt = 0
c = c-1
while c >= 0 {
    if !As.contains(s[c]){
        while !As.contains(s[k]){
            k += 1
            cnt += 1
        }
        k += 1
        cnt += 1
    }
    c -= 1
    cnt += 1
}
print(cnt)
0