Advertisement
Saleh127

at 104B

Oct 3rd, 2020
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define test int t; cin>>t; for(int cs=1;cs<=t;cs++)
  5. int main()
  6. {
  7. ios_base::sync_with_stdio(0);
  8. cin.tie(0);
  9. cout.tie(0);
  10.  
  11.  
  12. string a;
  13.  
  14. ll c,d,e,f=0,i,j,k,l;
  15.  
  16. cin>>c>>a;
  17.  
  18. for(i=0; i<c; i++)
  19. {
  20. k=l=0;
  21. for(j=i; j<c; j++)
  22. {
  23. if (a[j] == 'A')
  24. k++;
  25. else if (a[j] == 'T')
  26. k--;
  27. else if (a[j] == 'C')
  28. l++;
  29. else
  30. l--;
  31.  
  32. if(k==0 && l==0) f++;
  33. }
  34. }
  35.  
  36. cout<<f<<endl;
  37.  
  38.  
  39. return 0;
  40. }
  41.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement