結果
| 問題 |
No.1943 消えたAGCT(1)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-09-15 16:00:32 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 704 bytes |
| コンパイル時間 | 594 ms |
| コンパイル使用メモリ | 68,156 KB |
| 最終ジャッジ日時 | 2025-02-16 22:34:10 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 22 TLE * 5 |
ソースコード
#include <iostream>
#include <string>
using namespace std;
int main(void){
int n;
cin >> n;
string s, agct = "AGCT";
cin >> s;
int c = 0;
for (int i = 0; i < n; i++) {
for (int j = 0; j < 4; j++) {
if (s[i] == agct[j]) {
c++;
break;
}
}
}
int cnt = 0;
bool b;
while (c != 0) {
b = false;
for (int j = 0; j < 4; j++) {
if (s[c-1] == agct[j]) {
s.erase(c-1, 1);
b = true;
c--;
break;
}
}
if (b == false) s.erase(c-1, 1);
cnt++;
}
cout << cnt << endl;
}