結果

問題 No.1943 消えたAGCT(1)
ユーザー scrappyscrappy
提出日時 2022-10-18 14:48:58
言語 Go
(1.22.1)
結果
TLE  
実行時間 -
コード長 458 bytes
コンパイル時間 14,434 ms
コンパイル使用メモリ 215,952 KB
実行使用メモリ 4,564 KB
最終ジャッジ日時 2023-09-11 08:23:21
合計ジャッジ時間 34,922 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 5 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 TLE -
testcase_13 AC 512 ms
4,380 KB
testcase_14 AC 3 ms
4,380 KB
testcase_15 AC 1,895 ms
4,376 KB
testcase_16 AC 1,232 ms
4,380 KB
testcase_17 AC 1,381 ms
4,380 KB
testcase_18 TLE -
testcase_19 TLE -
testcase_20 TLE -
testcase_21 TLE -
testcase_22 AC 849 ms
4,384 KB
testcase_23 AC 850 ms
4,380 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Buffer(make([]byte, 500000+2), 500000+2)
	sc.Scan()
	sc.Scan()
	s := sc.Text()
	tt := []byte(s)

	c := 0
	for _, t := range tt {
		if t == 'A' || t == 'G' || t == 'C' || t == 'T' {
			c++
		}
	}

	n := 0
	for ; c > 0; n++ {
		t := tt[c-1]
		tt = append(tt[:c-1], tt[c:]...)
		if t == 'A' || t == 'G' || t == 'C' || t == 'T' {
			c--
		}
	}
	fmt.Println(n)
}
0