Problem link
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
int main() {
int a,b,c,d;
cin >> a >> b >> c >> d;
while (a!=0 || b!=0 || c!=0 || d!=0)
{
int g1,g2,g3;
if (b>a) g1 = 40-b+a; else g1 = a-b;
if (c>b) g2 = c-b; else g2=40-b+c;
if (d>c) g3 = 40+c-d; else g3 = c-d;
int result = 360*2 + g1*9 + 360 + g2*9 + g3*9;
cout << result << endl;
cin >> a >> b >> c >> d;
}
return 0;
}
No comments:
Post a Comment