csust-8.9早训CF之800-2200分

目录

 

A - Toda 2

B - Minimum and Maximum

C - Bulmart

D - Buy a Shovel

E - Cormen — The Best Friend Of a Man

F - Sanatorium


A - Toda 2

 CodeForces - 730A 

题目链接https://codeforces.com/problemset/problem/730/A

B - Minimum and Maximum

 CodeForces - 730B 

题目链接https://codeforces.com/problemset/problem/730/B

C - Bulmart

 CodeForces - 730C 

题目链接https://codeforces.com/problemset/problem/730/C

D - Buy a Shovel

 CodeForces - 732A 

题目链接https://codeforces.com/problemset/problem/732/A

#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false)
int main() 
{
	IOS;
	int ans, n, k, r, nb = 1;
	cin >> n >> r;
	k = n;
	while (1) {
		if (n % 10 == r || n%10==0) {
			break;
		}
		nb++; n += k;
	}
	cout << nb << endl; 
}

E - Cormen — The Best Friend Of a Man

 CodeForces - 732B 

题目链接https://codeforces.com/problemset/problem/732/B

#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false)
int a[550];
int main() 
{
	IOS;
	int ans, n, k, r, nb = 0;
	cin >> n >> r;
	for (int i = 1; i <= n; i++)
		cin >> a[i];
	for (int i = 1; i < n; i++) {
		if (a[i] + a[i + 1] < r) nb += r - a[i] - a[i + 1], a[i + 1] += r - a[i] - a[i + 1];
	}
	cout << nb << endl; 
	for (int i = 1; i <= n; i++)
		cout << a[i] << " ";
	cout << endl;
	return 0;
}

F - Sanatorium

 CodeForces - 732C 

题目链接https://codeforces.com/problemset/problem/732/C

#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false)
#define ll long long
const int inf = 1e18 + 10;
const int mac = 1e6 + 10;
int main()
{
	IOS;
	ll a, b, c;
	cin >> a >> b >> c;
	ll ans = inf;
	ll r = max(a, b);
	r = max(r, c);
	ll m = 0;
	if (a < r) m = r - 1 - a;
	if (b < r) m += r - 1 - b;
	if (c < r) m += r - 1 - c;
	cout << m << endl;
	return 0;
}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值