Created
June 12, 2019 09:37
-
-
Save aliciawyy/02416a6ebb426d08c0b3879512e12322 to your computer and use it in GitHub Desktop.
combo.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Created by alice on 11/06/19. | |
// | |
/* | |
ID: raining5 | |
PROG: combo | |
LANG: C++ | |
*/ | |
/* LANG can be C++11 or C++14 for those more recent releases */ | |
#include <bits/stdc++.h> | |
using namespace std; | |
const string kProgName = "combo"; | |
int solve() { | |
ifstream f_in (kProgName + ".in"); | |
int n, delta[3], m, count = 250; | |
f_in >> n; | |
if (n <= 5) { return n * n * n; } | |
for (int j = 0; j < 3; ++j) { | |
f_in >> delta[j]; | |
} | |
for (int j = 0; j < 3; ++j) { | |
f_in >> m; | |
m -= delta[j]; | |
delta[j] = min((n + m) % n, (n - m) % n); | |
if (delta[j] > 4) { return count; } | |
} | |
return count - (5 - delta[0]) * (5 - delta[1]) * (5 - delta[2]); | |
} | |
int main() { | |
ofstream f_out (kProgName + ".out"); | |
f_out << solve() << endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment