113052024-08-07 14:14:07TomaSajtDNS szakaszok száma (75 pont)cpp17Accepted 75/757ms2420 KiB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;

  vector<ll> is_a(n), is_t(n);

  ll a = 0, ag = 0, res = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == 'A') a++;
    else if (s[i] == 'G') ag += a, a = 0;
    else if (s[i] == 'T') res += ag;
  }
  cout << res;
}
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/03ms416 KiB
2Accepted0/07ms2344 KiB
3Accepted3/33ms384 KiB
4Accepted4/43ms404 KiB
5Accepted4/43ms376 KiB
6Accepted4/43ms356 KiB
7Accepted4/43ms384 KiB
8Accepted3/33ms356 KiB
9Accepted3/33ms552 KiB
10Accepted4/43ms356 KiB
11Accepted4/43ms504 KiB
12Accepted4/42ms376 KiB
13Accepted4/43ms504 KiB
14Accepted4/42ms360 KiB
15Accepted3/37ms2200 KiB
16Accepted4/47ms2284 KiB
17Accepted4/47ms2276 KiB
18Accepted4/46ms2340 KiB
19Accepted4/46ms2276 KiB
20Accepted4/46ms2420 KiB
21Accepted3/36ms2276 KiB
22Accepted4/46ms2296 KiB