Add FZOI Codes

This commit is contained in:
2024-06-26 22:14:00 +08:00
parent 8f564ca60e
commit b80791cfad
49 changed files with 1653 additions and 0 deletions

View File

@ -0,0 +1,21 @@
#include <iostream>
using namespace std;
int n, a[30], j, k;
int main(){
cin >> n;
if(n % 2 == 1) cout << -1;
else{
for(int i = n; i != 0; i /= 2){
j ++ ;
a[j] = i % 2;
}
k = j - 1;
for(int i = j; i >= 1; i -- ){
long long s = pow(2, k);
if(a[i] != 0) cout << s << " " ;
k -- ;
}
}
return 0;
}