Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- #include <iostream>
- #include <vector>
- using namespace std;
- vector<int>x(10);
- int f(int i) {
- int t = 0;
- if (x[i + 1] == 10 && i + 1 != 9) {
- if (i + 2 < 9) {
- t += 20 + x[i + 2];
- }
- else {
- t += 20;
- }
- }
- else
- {
- if(i + 1 != 9) t += 10 + x[i + 1];
- else t += 10;
- }
- return t;
- }
- int main()
- {
- #if _DEBUG
- freopen("input.txt", "r", stdin);
- freopen("output.txt", "w", stdout);
- #endif
- ios_base::sync_with_stdio(false);
- cin.tie(0);
- int min = 0, max = 0;
- for (int i = 0; i < 10; ++i)
- {
- cin >> x[i];
- if (x[9] >= 21 && x[8] == 10 && i == 9)
- {
- min += x[i] + 10;
- }
- else
- {
- min += x[i];
- }
- }
- for (int i = 0; i < 9; ++i) {
- if (x[i] == 10) {
- max += f(i);
- }
- else {
- max += x[i];
- }
- }
- if (x[9] < 10)
- {
- if (x[8] == 10 && x[7] == 10)
- {
- max += 3 * x[9];
- }
- else
- {
- if (x[8] == 10) max += 2 * x[9];
- else max += x[9];
- }
- }
- else
- {
- if (x[9] <= 20)
- {
- if (x[8] == 10 && x[7] == 10)
- {
- max += x[9] + (x[9] - 10) + 20;
- }
- else
- {
- if (x[8] == 10) max += 2 * x[9];
- else max += x[9];
- }
- }
- else
- {
- if (x[9] <= 30)
- {
- if (x[8] == 10 && x[7] == 10)
- {
- max += 30 + x[9];
- }
- else
- {
- if (x[8] == 10) max += 20 + x[9];
- else max += x[9];
- }
- }
- }
- }
- cout << min << ' ' << max;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement