Initial commit

This commit is contained in:
2022-06-01 20:14:50 +03:00
commit 8b9cce4739
1094 changed files with 68851 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define pi pair<ll, ll>
#define sz(x) (int)((x).size())
#define all(a) (a).begin(), (a).end()
const ll mod = 1e9+7;
ll n, k, m, mi, ma;
void solve(){
cin >> n;
map<ll, ll> q;
vector<pi> ans;
for(int i = 1; i*i < n; i++) q[i*i] = i;
for(int i = 1; i*i < n - i*i; i++){
if(q[n - i*i] == 0) continue;
ll j = q[n - i*i];
ll b = j*j - i*i;
ll a = 2*i*j;
if(a > b) swap(a, b);
if(a < 0) continue;
if(__gcd(a, b) != 1 || __gcd(b, n) != 1) continue;
ans.pb({a, b});
}
sort(all(ans));
for(int i = 0; i<ans.size(); i++) cout << ans[i].f << " " << ans[i].s << " " << n << "\n";
if(ans.size() == 0){
cout << "NOPE\n";
return;
}
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
//init();
int t=1;
// cin >> t;
while(t--) solve();
return 0;
}