Guest User

Untitled

a guest
Sep 29th, 2019
162
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<iostream>
  2. #include<cmath>
  3. #include<vector>
  4.  
  5. int main(){
  6. using namespace std;
  7.  
  8. std::vector<int>input;
  9. char newSymbol;
  10.  
  11. cin.sync_with_stdio(false);
  12. std::cin>>newSymbol;
  13.  
  14. while(newSymbol!=46)
  15. {
  16. cin.sync_with_stdio(false);
  17. input.push_back(newSymbol);
  18. std::cin>>newSymbol;
  19. }
  20.  
  21.  
  22. int vecSize=input.size()/5;
  23.  
  24. std::vector<int>allDNA(vecSize);
  25.  
  26. int str=0;
  27. int firstDigit;
  28. int secondDigit;
  29. int thirdDigit;
  30. int fourthDigit;
  31. int fifthDigit;
  32.  
  33. for(int i=0;i<vecSize;++i)
  34. {
  35. if(input[str+4]>=97&&input[str+4]<=102)
  36. {
  37. firstDigit=(int)input[str+4]-87;
  38. }else
  39. {
  40. firstDigit=input[str+4]-48;
  41. }
  42.  
  43. if(input[str+3]>=97&&input[str+3]<=102)
  44. {
  45. secondDigit=((int)input[str+3]-87)*16;
  46. }else
  47. {
  48. secondDigit=(input[str+3]-48)*16;
  49. }
  50.  
  51. if(input[str+2]>=97&&input[str+2]<=102)
  52. {
  53. thirdDigit=((int)input[str+2]-87)*16*16;
  54. }else
  55. {
  56. thirdDigit=(input[str+2]-48)*16*16;
  57. }
  58.  
  59. if(input[str+1]>=97&&input[str+1]<=102)
  60. {
  61. fourthDigit=((int)input[str+1]-87)*16*16*16;
  62. }else
  63. {
  64. fourthDigit=(input[str+1]-48)*16*16*16;
  65. }
  66.  
  67. if(input[str]>=97&&input[str]<=102)
  68. {
  69. fifthDigit=((int)input[str]-87)*16*16*16*16;
  70. }else
  71. {
  72. fifthDigit=(input[str]-48)*16*16*16*16;
  73. }
  74.  
  75.  
  76. allDNA[i]=firstDigit+secondDigit+thirdDigit+fourthDigit+fifthDigit;
  77. str+=5;
  78. }
  79.  
  80. int resultHex;
  81. bool checker=false;
  82.  
  83. for(int i=0;i<allDNA.size();++i)
  84. {
  85. for(int j=0;j<allDNA.size();++j)
  86. {
  87.  
  88. if(allDNA[i]==allDNA[j]&&i!=j)
  89. {
  90. allDNA.erase(allDNA.begin()+j);
  91. j-=1;
  92. checker=true;
  93.  
  94. }
  95.  
  96. }
  97.  
  98. if(checker==false)
  99. {
  100. break;
  101. }else
  102. {
  103. allDNA.erase(allDNA.begin()+i);
  104. i-=1;
  105. }
  106. checker=false;
  107. }
  108.  
  109. resultHex=allDNA[0];
  110.  
  111. long long resultDecFive=((resultHex/16.00)-(resultHex/16))*16;
  112. resultHex/=16;
  113.  
  114. long long resultDecFour=((resultHex/16.00)-(resultHex/16))*16;
  115. resultHex/=16;
  116.  
  117. long long resultDecThree=((resultHex/16.00)-(resultHex/16))*16;
  118. resultHex/=16;
  119.  
  120. long long resultDecTwo=((resultHex/16.00)-(resultHex/16))*16;
  121. resultHex/=16;
  122.  
  123. long long resultDecOne=((resultHex/16.00)-(resultHex/16))*16;
  124.  
  125.  
  126. cout.sync_with_stdio(false);
  127.  
  128. switch(resultDecOne)
  129. {
  130. case 10:
  131. cout<<"a";
  132. break;
  133. case 11:
  134. cout<<"b";
  135. break;
  136. case 12:
  137. cout<<"c";
  138. break;
  139. case 13:
  140. cout<<"d";
  141. break;
  142. case 14:
  143. cout<<"e";
  144. break;
  145. case 15:
  146. cout<<"f";
  147. break;
  148. default:
  149. cout<<resultDecOne;
  150. }
  151.  
  152. switch(resultDecTwo)
  153. {
  154. case 10:
  155. cout<<"a";
  156. break;
  157. case 11:
  158. cout<<"b";
  159. break;
  160. case 12:
  161. cout<<"c";
  162. break;
  163. case 13:
  164. cout<<"d";
  165. break;
  166. case 14:
  167. cout<<"e";
  168. break;
  169. case 15:
  170. cout<<"f";
  171. break;
  172. default:
  173. cout<<resultDecTwo;
  174. }
  175.  
  176. switch(resultDecThree)
  177. {
  178. case 10:
  179. cout<<"a";
  180. break;
  181. case 11:
  182. cout<<"b";
  183. break;
  184. case 12:
  185. cout<<"c";
  186. break;
  187. case 13:
  188. cout<<"d";
  189. break;
  190. case 14:
  191. cout<<"e";
  192. break;
  193. case 15:
  194. cout<<"f";
  195. break;
  196. default:
  197. cout<<resultDecThree;
  198. }
  199.  
  200. switch(resultDecFour)
  201. {
  202. case 10:
  203. cout<<"a";
  204. break;
  205. case 11:
  206. cout<<"b";
  207. break;
  208. case 12:
  209. cout<<"c";
  210. break;
  211. case 13:
  212. cout<<"d";
  213. break;
  214. case 14:
  215. cout<<"e";
  216. break;
  217. case 15:
  218. cout<<"f";
  219. break;
  220. default:
  221. cout<<resultDecFour;
  222. }
  223.  
  224. switch(resultDecFive)
  225. {
  226. case 10:
  227. cout<<"a";
  228. break;
  229. case 11:
  230. cout<<"b";
  231. break;
  232. case 12:
  233. cout<<"c";
  234. break;
  235. case 13:
  236. cout<<"d";
  237. break;
  238. case 14:
  239. cout<<"e";
  240. break;
  241. case 15:
  242. cout<<"f";
  243. break;
  244. default:
  245. cout<<resultDecFive;
  246. }
  247.  
  248. return 0;
  249. }
RAW Paste Data