144272025-01-10 18:30:11vargaviviDNS szakaszok száma (75 pont)cpp17Accepted 75/754ms624 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    string s;
    cin >> n >> s;
    int ad1 = 0;
    int ad2 = 0;
    long db = 0;
    for (int i = 0; i < n; i ++) {
            if (s[i] == 'A') ad2 += 1;
            else if (s[i] == 'G') {
                ad1 += ad2;
                ad2 = 0;
            }
            else if (s[i] == 'T') db += ad1;
    }
    cout << db;
    return 0;

}

//int n;
//string s;
//  cin >> n >> s;
//vector<int> dp(n);
//int k = 0;
//int db = 0;
//    for (int i = n - 1; i >= 0; i --) {
  //      if (s[i] == 'T') k += 1;
    //    dp[i] = k;
  //  }
  //  for (int i = 0; i < n; i ++) {
    //    if (s[i] == 'A') {
     //       for (int j = i; j < n; j ++) {
      //          if (s[j] == 'G') {
        //            db += dp[j];
         //           break;
           //     }
       //     }
      //  }
  //  }
    //cout << db;
  //  return 0;
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/01ms316 KiB
2Accepted0/04ms564 KiB
3Accepted3/31ms316 KiB
4Accepted4/41ms316 KiB
5Accepted4/41ms500 KiB
6Accepted4/41ms316 KiB
7Accepted4/41ms380 KiB
8Accepted3/31ms316 KiB
9Accepted3/31ms316 KiB
10Accepted4/41ms500 KiB
11Accepted4/41ms508 KiB
12Accepted4/41ms316 KiB
13Accepted4/41ms316 KiB
14Accepted4/41ms316 KiB
15Accepted3/34ms568 KiB
16Accepted4/44ms520 KiB
17Accepted4/44ms520 KiB
18Accepted4/44ms564 KiB
19Accepted4/44ms500 KiB
20Accepted4/44ms624 KiB
21Accepted3/34ms564 KiB
22Accepted4/44ms384 KiB