結果
問題 | No.1943 消えたAGCT(1) |
ユーザー |
![]() |
提出日時 | 2022-05-20 22:18:10 |
言語 | D (dmd 2.109.1) |
結果 |
AC
|
実行時間 | 14 ms / 2,000 ms |
コード長 | 364 bytes |
コンパイル時間 | 1,920 ms |
コンパイル使用メモリ | 205,356 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-22 15:14:51 |
合計ジャッジ時間 | 2,907 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 |
ソースコード
import std;void main() {int n;readf("%d\n", n);auto s = readln.chomp;auto r = "AGCT";int cnt;foreach (i, x; s) {if (r.canFind(x)) ++cnt;}int res, pos = cnt - 1, tmp = cnt;while (cnt > 0) {++res;if (r.canFind(s[pos])) pos = --cnt - 1;else pos = tmp++;}res.writeln;}