Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <string>
  4. #include <cstring>
  5. #include <algorithm>
  6. #define LEN 6*25
  7. #include <vector>
  8. using namespace std;
  9. ifstream f("/Users/student/Desktop/innn.txt");
  10. int main(){
  11.  
  12. string s;
  13. f >> s;
  14. vector<int> v;
  15. int minv = 0;
  16. long min0 = 9999999;
  17. cout << s.length() << endl;
  18. while (s.length()){
  19. string p = s.substr(0, LEN);
  20. int c0 = count(p.begin(), p.end(), '0');
  21. int c1 = count(p.begin(), p.end(), '1');
  22. int c2 = count(p.begin(), p.end(), '2');
  23. if (c0 < min0){
  24. min0 = c0;
  25. minv = c1*c2;
  26. }
  27. v.push_back(p[0]-'0');
  28. v.push_back(p[24]-'0');
  29. v.push_back(p[5*24+1]-'0');
  30. v.push_back(p[LEN-1]-'0');
  31. s = s.substr(LEN);
  32. }
  33. //cout << minv << endl; //part 1;
  34. int x[5];
  35. for (int i = v.size()-1; i >= 0; i--){
  36. if (v[i] != 2){
  37. x[i%4] = v[i];
  38. }
  39. }
  40. for (int i = 0; i < 4; i++)
  41. cout << x[i];
  42. cout << endl;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement