http://ybt.ssoier.cn:8088/problem_show.php?pid=2004
#include <bits/stdc++.h>
using namespace std;
int main() {
freopen("data.in", "r", stdin);
freopen("1.out", "w", stdout);
int n;
cin >> n;
if (n % 2 == 1) cout << -1 << endl;
else {
while (n) {
int t = pow(2, (int)log2(n));
cout << t << ' ';
n -= t;
}
}
return 0;
}
#include <bits/stdc++.h>
using namespace std;
int main() {
freopen("data.in", "r", stdin);
freopen("2.out", "w", stdout);
int n;
cin >> n;
if (n & 1 == 1) cout << -1 << endl;
else {
stack <int> s;
while (n) {
s.push(n & -n);
n -= n & -n;
}
while (s.size()) {
cout << s.top() << ' ';
s.pop();
}
}
return 0;
}
#include <bits/stdc++.h>
using namespace std;
int myrand() {
return (rand()<<16) + (rand()<<1) + (rand()&1);
}
int main() {
freopen("data.in", "w", stdout);
srand(time(0));
int n = myrand();
cout << n << endl;
return 0;
}
@echo off
:loop
make_file
1
2
fc 1.out 2.out
if errorlevel == 1 pause
goto loop
@echo off
:loop
echo ~~~~~~~~~~~~~~~~~~~
make_file
echo 輸入
type data.in
echo 輸出:
type 1.out
echo ~~~~~~~~~~~~~~~~~~~
pause
goto loop
#include <bits/stdc++.h>
using namespace std;
int myrand() {
//三個部分都要加上括号,才能得到想要的随機數
return (rand()<<16) + (rand()<<1) + (rand()&1);
}
int main() {
freopen("data.in", "w", stdout);
// cout << time(0);
//如果不引人時間作為随機數種子,則每次得到的随機數序列都是一樣的
srand(time(0));
// int n = myrand();
// cout << n << endl;
int minn = 1e9;
int maxx = 0;
for (int i = 1; i <= 1000000; i ++) {
int t = rand();
cout << t << endl;
minn = min(minn, t);
maxx = max(maxx, t);
}
//rand()函數傳回值範圍 [0~32767]
cout << minn << endl;
cout << maxx << endl;
return 0;
}