152012025-02-16 12:26:42balintttDNS szakaszok száma (75 pont)cpp17Wrong answer 3/754ms576 KiB
#include <iostream>
#include <string>

using namespace std;

int main() {
    int n;
    string dna;

    // Read input
    cin >> n >> dna;

    // Initialize variables
    int count = 0;
    bool foundA = false;
    bool foundG = false;
    bool foundT = false;

    // Iterate over the DNA chain
    for (int i = 0; i < n; i++) {
        // Check if the current base is A
        if (dna[i] == 'A') {
            foundA = true;
        }
        // Check if the current base is G
        else if (dna[i] == 'G') {
            foundG = true;
        }
        // Check if the current base is T
        else if (dna[i] == 'T') {
            foundT = true;
        }

        // If we have found all three bases, increment the count
        if (foundA && foundG && foundT) {
            count++;
            foundA = false;
            foundG = false;
            foundT = false;
        }
    }

    // Print the count
    cout << count << endl;

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base3/75
1Wrong answer0/01ms316 KiB
2Wrong answer0/04ms576 KiB
3Accepted3/31ms316 KiB
4Wrong answer0/41ms316 KiB
5Wrong answer0/41ms316 KiB
6Wrong answer0/41ms316 KiB
7Wrong answer0/41ms316 KiB
8Wrong answer0/31ms320 KiB
9Wrong answer0/31ms316 KiB
10Wrong answer0/41ms316 KiB
11Wrong answer0/41ms508 KiB
12Wrong answer0/41ms316 KiB
13Wrong answer0/41ms316 KiB
14Wrong answer0/41ms316 KiB
15Wrong answer0/34ms564 KiB
16Wrong answer0/44ms576 KiB
17Wrong answer0/44ms564 KiB
18Wrong answer0/44ms564 KiB
19Wrong answer0/43ms564 KiB
20Wrong answer0/44ms564 KiB
21Wrong answer0/33ms464 KiB
22Wrong answer0/44ms564 KiB