#17631: 請問我哪裡錯了


rexwu1104@gmail.com (黑雪公主 Black Lotus)

學校 : 新北市私立南山高級中學
編號 : 93041
來源 : [49.216.131.103]
最後登入時間 :
2024-06-06 19:28:43
c006. 10550 - Combination Lock -- UVa10550 | From: [118.166.52.60] | 發表日期 : 2019-04-28 21:12

#include <iostream>
using namespace std;
int main() {
longlongint a, b, c, d, e, f=0, h, i, g=0;
  while ((cin >> a >> b >> c >> d)&&(a || b || c || d)) {
    if (a>b) {
      f = (b - a) * 9 + 360;
    }
    else {
      f = (b - a) * 9;
    }
    if (b>c) {
      h = (c - b) * 9;
    }
    else {
      h = (c - b) * 9 + 360;
    }
    if (c>d) {
      i = (d - c) * 9 + 360;
    }
    else {
      i = (d - c) * 9;
    }
    e = 720 + f + 360 + h + i;
    cout << e << endl;
  }
}
 
ZeroJudge Forum