9.25课件

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;
}

在这里插入图片描述
在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值