SHARE
TWEET

answer

a guest Apr 25th, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.    int n,sum=0;
  7.    int x[100];
  8.  
  9.     string s;
  10.  
  11.     cin>>n>>s;
  12.  
  13.     for(int i = 0; i<n-3;i++){
  14.         x[i]= 0;
  15.  
  16.         x[i]+=min(abs(s[i]-'A'),(abs('Z'-s[i]+1)));
  17.         x[i]+=min(abs(s[i+1]-'C'),(abs('Z'-s[i+1])+3));
  18.        x[i]+=min(abs(s[i+2]-'T'),(abs('Z'-s[i+2])+20));
  19.       x[i]+=min(abs(s[i+3]-'G'),(abs('Z'-s[i+3])+7));
  20. if(x[i]<x[i-1])
  21. {
  22.     sum=x[i];
  23. }
  24.     }
  25.  
  26.     cout<<sum<<endl;
  27.  
  28. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top