Advertisement
Fahim_7861

What is the Profile-most probable 6-mer in CTATAAACCTTACAT? 4

Dec 19th, 2020
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.24 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. typedef long long ll;
  4. typedef unsigned long long ull;
  5. typedef pair<ll,ll>pll;
  6. typedef pair<ll,pair<ll,ll>>plll;
  7. #define fastread() (ios_base:: sync_with_stdio(false),cin.tie(NULL));
  8. #define vll(v) v.begin(),v.end()
  9. #define all(x) x.rbegin(),x.rend()
  10. #define min3(a, b, c) min(a, min(b, c))
  11. #define max3(a, b, c) max(a, max(b, c))
  12. #define F first
  13. #define S second
  14. #define in freopen("input.txt", "r", stdin)
  15. #define out freopen("output.txt", "w", stdout)
  16. #define minheap int,vector<int>,greater<int>
  17. #define pb push_back
  18. #define eb emplace_back
  19. #define ischar(x) (('a' <= x && x <= 'z') || ('A' <= x && x <= 'Z'))
  20. #define isvowel(ch) ((ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')||(ch=='A'|| ch=='E' || ch=='I'|| ch=='O'|| ch=='U'))
  21. #define bug cout<<"BUG"<<endl;
  22. const int Max = 2e5 + 10;
  23. const int Mod = 1e9 + 7;
  24. const double PI =3.141592653589793238463;
  25. bool compare(const string &a, const string &b)
  26. {
  27. for(ll i=0; i<a.size(); i++)
  28. {
  29. if(a[i]!=b[i] && (a[i]=='$' || b[i]=='$'))
  30. {
  31.  
  32. if(a[i]=='$')return 1;
  33.  
  34. else if(b[i]=='$')return 0;
  35. }
  36.  
  37. else if(a[i]<b[i])return 1;
  38.  
  39. else if(a[i]>b[i])return 0;
  40. }
  41.  
  42. return 1;
  43. }
  44. ll lcm(ll a,ll b)
  45. {
  46. if(a==0 || b==0)return 0;
  47.  
  48. return a/__gcd(a,b)*b;
  49. }
  50.  
  51. void input(ll ara[],ll n)
  52. {
  53. for(ll i=0; i<n; i++)cin>>ara[i];
  54. }
  55. void print(ll ara[],ll n)
  56. {
  57. for(ll i=0; i<n; i++)
  58. cout<<ara[i]<<" ";
  59. cout<<endl;
  60. }
  61.  
  62.  
  63.  
  64. void printCycleRotation(vector<string>cyclicRotation)
  65. {
  66.  
  67. for(auto x : cyclicRotation)
  68. cout<<x<<endl;
  69. }
  70.  
  71.  
  72. double ara[5][100];
  73.  
  74. ll number(char ch)
  75. {
  76. if(ch=='A')return 1;
  77.  
  78. else if(ch=='C')return 2;
  79.  
  80. else if(ch=='T')return 3;
  81.  
  82. else return 4;
  83. }
  84.  
  85.  
  86. double profileValue(string str)
  87. {
  88. double ans=1;
  89.  
  90. ll i;
  91.  
  92.  
  93. for(i=0; i<str.size(); i++)
  94. {
  95. ans*=ara[number(str[i])][i];
  96. }
  97.  
  98. return ans;
  99. }
  100. int main()
  101. {
  102.  
  103. fastread();
  104.  
  105. ll i,j,n,m,p,sum=0,k,t,c,d,cnt=0,q,l,r;
  106.  
  107. bool flag=false;
  108.  
  109.  
  110. double a,b,temp;
  111.  
  112. cin>>n;
  113.  
  114.  
  115. for(i=1; i<=4; i++)
  116. {
  117. for(j=0; j<n; j++)
  118. {
  119. cin>>a>>b;
  120.  
  121. double temp=a/b;
  122.  
  123. ara[i][j]=temp;
  124. }
  125. }
  126.  
  127. for(i=1; i<=4; i++)
  128. {
  129. for(j=0; j<n; j++)
  130. cout<<ara[i][j]<<" ";
  131.  
  132. cout<<endl;
  133. }
  134.  
  135.  
  136.  
  137.  
  138. double ans=0;
  139.  
  140.  
  141.  
  142.  
  143. string str;
  144.  
  145. cin>>str>>k;
  146.  
  147. ll len=str.size();
  148.  
  149. string Ans;
  150.  
  151. for(i=0; i<len; i++)
  152. {
  153. if(i+k<=len)
  154. {
  155. string sub=str.substr(i,k);
  156.  
  157. double temp=profileValue(sub);
  158.  
  159. if(temp>ans)
  160. {
  161. ans=temp;
  162.  
  163. Ans=sub;
  164. }
  165. }
  166. }
  167.  
  168. cout<<ans<<" "<<Ans<<endl;
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179. }
  180.  
  181.  
  182. //GCAGGGTGCA
  183.  
  184. /*
  185.  
  186. 6
  187. 1 2
  188. 7 8
  189. 3 8
  190. 0 1
  191. 1 8
  192. 0 1
  193. 1 8
  194. 0 1
  195. 1 2
  196. 5 8
  197. 3 8
  198. 0 1
  199. 1 8
  200. 1 8
  201. 0 1
  202. 0 1
  203. 1 4
  204. 7 8
  205. 1 4
  206. 0 1
  207. 1 8
  208. 3 8
  209. 1 4
  210. 1 8
  211. CTATAAACCTTACAT 6
  212.  
  213. */
  214.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement