Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- by: senb1
- */
- #include <bits/stdc++.h>
- #define ll long long
- #define ull unsigned long long
- #define all(x) x.begin(), x.end()
- #define fr first
- #define sc second
- #define mk make_pair
- #define rall(x) x.rbegin(), x.rend()
- #define endl '\n'
- using namespace std;
- const ll mod = 998244353;
- const ll maxn = 1e6 + 5;
- const ll inf = 1e9 + 6;
- void solve() {
- int m, o, a, b;
- cin >> m >> o >> a >> b;
- for (int x = 0; x <= m; x++) {
- for (int y = 0; y <= m; y++) {
- for (int z = 0; z <= m; z++) {
- if (x * x + y * y + z * z == o) {
- if ((x - m) * (x - m) + y * y + z * z == a) {
- if (x * x + (y - m) * (y - m) + z * z == b) {
- cout << x << ' ' << y << ' ' << z << endl;
- return;
- }
- }
- }
- if (x * x + y * y + z * z > o) {
- break;
- }
- }
- if (x * x + y * y > o) {
- break;
- }
- }
- }
- }
- /*
- */
- 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