Commits

Anonymous committed 473d304

10550 adhoc easy

  • Participants
  • Parent commits a40dd5f

Comments (0)

Files changed (1)

+#include<cstdio>
+#include<sstream>
+#include<cstdlib>
+#include<cctype>
+#include<cmath>
+#include<algorithm>
+#include<set>
+#include<queue>
+#include<stack>
+#include<list>
+#include<iostream>
+#include<string>
+#include<vector>
+#include<cstring>
+#include<map>
+#include<cassert>
+#include<climits>
+using namespace std;
+
+#define REP(i,n) for(int i=0, _e(n); i<_e; i++)
+#define FOR(i,a,b) for(int i(a), _e(b); i<=_e; i++)
+#define FORD(i,a,b) for(int i(a), _e(b); i>=_e; i--) 
+#define FORIT(i, m) for (__typeof((m).begin()) i=(m).begin(); i!=(m).end(); ++i)
+#define SET(t,v) memset((t), (v), sizeof(t))
+#define ALL(x) x.begin(), x.end()
+#define UNIQUE(c) (c).resize( unique( ALL(c) ) - (c).begin() )
+
+#define sz size()
+#define pb push_back
+#define VI vector<int>
+#define VS vector<string>
+
+typedef long long LL;
+typedef long double LD;
+typedef pair<int,int> pii;
+
+#define D(x) if(1) cout << __LINE__ <<" "<< #x " = " << (x) << endl;
+#define D2(x,y) if(1) cout << __LINE__ <<" "<< #x " = " << (x) \
+     <<", " << #y " = " << (y) << endl;
+
+int mod(int a, int b, int n) {
+    if (a - b > 0) return (a - b) % n;
+    else return (n + (a - b));
+}
+
+int main() {
+    int n[4] = {};
+    
+    while(cin >> n[0] >> n[1] >> n[2] >> n[3] && (n[0]+n[1]+n[2]+n[3])) {
+        cout << 720 + 9 * mod(n[0], n[1], 40) + 360 + 9 * mod(n[2], n[1], 40) + 9 * mod(n[2], n[3], 40) << endl;
+    }
+    return 0;
+}