結果

問題 No.1943 消えたAGCT(1)
ユーザー Kome_soudouKome_soudou
提出日時 2022-05-20 23:20:34
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 436 bytes
コンパイル時間 1,536 ms
コンパイル使用メモリ 167,308 KB
実行使用メモリ 8,352 KB
最終ジャッジ日時 2023-10-20 14:12:50
合計ジャッジ時間 5,645 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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