結果
| 問題 | 
                            No.1943 消えたAGCT(1)
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2022-06-07 18:34:43 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 368 bytes | 
| コンパイル時間 | 1,951 ms | 
| コンパイル使用メモリ | 196,140 KB | 
| 最終ジャッジ日時 | 2025-01-29 18:54:00 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 15 TLE * 12 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
int n, m, c;
string s;
int ct(string s) {
	int u = 0;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == 'A' || s[i] == 'G' || s[i] == 'C' || s[i] == 'T')
			u++;
	}
	return u;
}
int main()
{
	cin >> n >> s;
	while (c = ct(s)) {
		s = s.substr(0, c - 1) + s.substr(c, n - c);
		n--;
		m++;
	}
	cout << m << endl;
}