結果

問題 No.1943 消えたAGCT(1)
ユーザー Kome_soudou
提出日時 2022-05-20 23:20:34
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 436 bytes
コンパイル時間 1,558 ms
コンパイル使用メモリ 166,288 KB
実行使用メモリ 13,756 KB
最終ジャッジ日時 2024-09-20 09:43:53
合計ジャッジ時間 5,387 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 11 WA * 4 TLE * 1 -- * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main()
{
	int N;
	string S;
	cin >> N >> S;
	
	int cnt = 0;
	for(int i = 0; i < N; i++) if(S[i] == 'A' || S[i] == 'G' || S[i] == 'C' || S[i] == 'T') cnt++;
	int ans = 0;
	while(cnt != 0)
	{
		for(int i = cnt - 1; ; i++)
		{
			ans++;
			if(S[i] == 'A' || S[i] == 'G' || S[i] == 'C' || S[i] == 'T')
			{
				S[i] = 'X';
				break;
			}
		}
		cnt--;
	}
	cout << ans << endl;
	return 0;
}
0