41 lines
836 B
C++
41 lines
836 B
C++
|
|
#include <bits/stdc++.h>
|
||
|
|
using namespace std;
|
||
|
|
<<<<<<< HEAD
|
||
|
|
|
||
|
|
int po(int x){
|
||
|
|
int res=1;
|
||
|
|
for (int i = 1; i <= x; i++) res *= 2;
|
||
|
|
return res;
|
||
|
|
}
|
||
|
|
int main() {
|
||
|
|
int n;
|
||
|
|
cin >> n;
|
||
|
|
if(n%2){
|
||
|
|
cout << -1 << endl;
|
||
|
|
return 0;
|
||
|
|
}
|
||
|
|
vector<int>vec;
|
||
|
|
while(n){
|
||
|
|
vec.push_back(n & 1);
|
||
|
|
n >>= 1;
|
||
|
|
}
|
||
|
|
for (int i = vec.size() - 1;i>=0;i--)
|
||
|
|
if (vec[i]) cout << po(i) << " ";
|
||
|
|
return 0;
|
||
|
|
=======
|
||
|
|
typedef long long LL;
|
||
|
|
int main() {
|
||
|
|
int k;
|
||
|
|
cin>>k;
|
||
|
|
while(k--){
|
||
|
|
LL n,d,e;
|
||
|
|
cin>>n>>d>>e;
|
||
|
|
LL m=n-e*d+2;
|
||
|
|
LL dt = m*m-4*n;
|
||
|
|
LL r=sqrt(dt);
|
||
|
|
if(dt<0||r*r!=dt)cout<<"NO"<<endl;
|
||
|
|
else cout<<(m-r)/2<<" "<<(m+r)/2<<endl;
|
||
|
|
}
|
||
|
|
return 0;
|
||
|
|
>>>>>>> 1d3cfa8d4ce1d62bf5d63fb303462f32c1f785c7
|
||
|
|
}
|