Advertisement
Guest User

uva_10550.cpp

a guest
Nov 20th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.     int a, b, c, d, degree;
  7.     while(cin >> a >> b >> c >> d && (a != 0 || b != 0 || c != 0 || d != 0)) {
  8.         degree = 1080;
  9.         if(a <= b) {
  10.             degree += (b - a) * 9;
  11.         }
  12.         else {
  13.             degree += (40 - a) * 9;
  14.         }
  15.         a = b;
  16.         if(a < c) {
  17.             degree += (40 - a) * 9;
  18.         }
  19.         else {
  20.             degree += (a - c) * 9;
  21.         }
  22.         a = c;
  23.         if(a <= d) {
  24.             degree += (d - a) * 9;
  25.         }
  26.         else {
  27.             degree += (40 - a) * 9;
  28.         }
  29.         cout << degree << endl;
  30.     }
  31.  
  32.     return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement