Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- by: senb1
- */
- #include <bits/stdc++.h>
- #define ll long long
- #define all(x) x.begin(), x.end()
- #define fr first
- #define sc second
- #define mk make_pair
- using namespace std;
- const ll mod = 1000;
- ll binpow(ll x, ll y) {
- ll res = 1;
- while (y) {
- if (y & 1)
- res = (res * x) % mod;
- x = (x * x) % mod;
- y >>= 1;
- }
- return res;
- }
- void solve() {
- int f1, f2, f3, f4, f5, f6;
- cin >> f1 >> f2 >> f3 >> f4 >> f5 >> f6;
- int mxcnt = 0;
- for (int a = 0; a < 10; a++) {
- for (int b = 0; b < 10; b++) {
- for (int c = 0; c < 10; c++) {
- int cnt = 0;
- for (int d = 0; d < 10; d++) {
- if (f1 == a + b + c + d)
- cnt++;
- if (f2 = 8 * a + 4 * b + 2 * c + d)
- cnt++;
- if (f3 == 27 * a + 9 * b + 3 * c + d)
- cnt++;
- if (f4 == 64 * a + 16 * b + 4 * c + d)
- cnt++;
- if (f5 == 125 * a + 25 * b + 5 * c + d)
- cnt++;
- if (f6 == 216 * a + 36 * b + 6 * c + d)
- cnt++;
- if (cnt >= 5) {
- cout << 1000 * a + 100 * b + 10 * c + d;
- return;
- }
- cnt = 0;
- mxcnt = max(mxcnt, cnt);
- }
- }
- }
- }
- }
- /*
- * f1 = a + b + c + d;
- * f2 = 8a + 4b + 2c + d;
- * f3 = 27a + 9b + 3c + d;
- * f4 = 64a + 16b + 3c + d;
- * f5 = 125a + 25b + 5b + d;
- * f6 = 216a + 36b + 6c + d;
- */
- int main() {
- ios::sync_with_stdio(0);
- cin.tie(0);
- int t = 1;
- // cin >> t;
- while (t--)
- solve();
- }
Advertisement
Add Comment
Please, Sign In to add comment