目录
E - Cormen — The Best Friend Of a Man
A - Toda 2
题目链接https://codeforces.com/problemset/problem/730/A
B - Minimum and Maximum
题目链接https://codeforces.com/problemset/problem/730/B
C - Bulmart
题目链接https://codeforces.com/problemset/problem/730/C
D - Buy a Shovel
题目链接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
题目链接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
题目链接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;
}