結果

問題 No.1943 消えたAGCT(1)
ユーザー atjh16
提出日時 2022-06-07 18:45:45
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 411 bytes
コンパイル時間 1,917 ms
コンパイル使用メモリ 196,952 KB
最終ジャッジ日時 2025-01-29 18:55:01
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10 TLE * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int n, m, c;
string s;
bool f;

bool ist(string s, int t) {
	return s[t] == 'A' || s[t] == 'G' || s[t] == 'C' || s[t] == 'T';
}

int main()
{
	cin >> n >> s;

	for (int i = 0; i < s.size(); i++) {
		if(ist(s, i))
			c++;
	}

	while (c) {
		f = ist(s, c - 1);
		s = s.substr(0, c - 1) + s.substr(c, n - c);

		if (f)
			c--;

		n--;
		m++;
	}

	cout << m << endl;
}
0