Advertisement
IISergeyII

Untitled

May 26th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.27 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <string>
  4. #include <algorithm>
  5. #include <vector>
  6.  
  7. using namespace std;
  8.  
  9. bool cmp(vector<int> a, vector<int> b) {
  10.     if (a.size() > b.size()) {
  11.         return true;
  12.     } else if (a.size() < b.size()) {
  13.         return false;
  14.     } else {
  15.         int i = 0;
  16.         while (i < a.size() && a[i] == b[i]) i++;
  17.         if (i == a.size() || a[i] > b[i]) {
  18.             return true;
  19.         } else {
  20.             return false;
  21.         }
  22.     }
  23.  
  24. }
  25.  
  26. vector<int> minV(vector<int> a, vector<int> b) {
  27.     if (cmp(a, b)) {
  28.         return b;
  29.     } else {
  30.         return a;
  31.     }
  32. }
  33.  
  34. vector<int> maxV(vector<int> a, vector<int> b) {
  35.     if (cmp(a, b)) {
  36.         return a;
  37.     } else {
  38.         return b;
  39.     }
  40. }
  41.  
  42. int main()
  43. {
  44.     vector<int> a, b, c;
  45.  
  46.     string s;
  47.     getline(cin, s);
  48.     long long d = 0;
  49.  
  50.     while (s[d] != ' ') {
  51.         a.push_back(s[d] - '0');
  52.         d++;
  53.     }
  54.     d++;
  55.  
  56.     while (s[d] != ' ') {
  57.         b.push_back(s[d] - '0');
  58.         d++;
  59.     }
  60.     d++;
  61.  
  62.     while (d < s.length()) {
  63.         c.push_back(s[d] - '0');
  64.         d++;
  65.     }
  66.  
  67.     vector<int> ans = maxV( maxV(a, b), c );
  68.     for (int i = 0; i < ans.size(); i++) {
  69.         cout << ans[i];
  70.     }
  71.  
  72.  
  73.     return 0;
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement