Advertisement
Guest User

Untitled

a guest
Sep 28th, 2019
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.66 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <string>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     ofstream fout("paint.out");
  10.     ifstream fin("paint.in");
  11.     int a, b, c, d, output, temp;
  12.     fin >> a >> b >> c >> d;
  13.  
  14.     if (c < a)
  15.     {
  16.         printf("Hello");
  17.         temp = c;
  18.         c = a;
  19.         a = temp;
  20.  
  21.         temp = b;
  22.         b = d;
  23.         d = temp;
  24.     }
  25.  
  26.     if (c <= b)
  27.     {
  28.         if (d > b)
  29.         {
  30.             output = d - a;
  31.         }
  32.         else
  33.         {
  34.             output = b - a;
  35.         }
  36.     }
  37.  
  38.     else
  39.     {
  40.         output = (b - a) + (d - c);
  41.     }
  42.  
  43.     fout << output << endl;
  44.     return 0;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement