Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS
  2.  
  3. #include <iostream>
  4. #include <vector>
  5.  
  6. using namespace std;
  7. vector<int>x(10);
  8.  
  9. int f(int i) {
  10. int t = 0;
  11. if (x[i + 1] == 10 && i + 1 != 9) {
  12. if (i + 2 < 9) {
  13. t += 20 + x[i + 2];
  14. }
  15. else {
  16. t += 20;
  17. }
  18. }
  19. else
  20. {
  21. if(i + 1 != 9) t += 10 + x[i + 1];
  22. else t += 10;
  23. }
  24. return t;
  25. }
  26.  
  27. int main()
  28. {
  29. #if _DEBUG
  30. freopen("input.txt", "r", stdin);
  31. freopen("output.txt", "w", stdout);
  32. #endif
  33. ios_base::sync_with_stdio(false);
  34. cin.tie(0);
  35. int min = 0, max = 0;
  36. for (int i = 0; i < 10; ++i)
  37. {
  38. cin >> x[i];
  39. if (x[9] >= 21 && x[8] == 10 && i == 9)
  40. {
  41. min += x[i] + 10;
  42. }
  43. else
  44. {
  45. min += x[i];
  46. }
  47. }
  48. for (int i = 0; i < 9; ++i) {
  49. if (x[i] == 10) {
  50. max += f(i);
  51. }
  52. else {
  53. max += x[i];
  54. }
  55. }
  56. if (x[9] < 10)
  57. {
  58. if (x[8] == 10 && x[7] == 10)
  59. {
  60. max += 3 * x[9];
  61. }
  62. else
  63. {
  64. if (x[8] == 10) max += 2 * x[9];
  65. else max += x[9];
  66. }
  67. }
  68. else
  69. {
  70. if (x[9] <= 20)
  71. {
  72. if (x[8] == 10 && x[7] == 10)
  73. {
  74. max += x[9] + (x[9] - 10) + 20;
  75. }
  76. else
  77. {
  78. if (x[8] == 10) max += 2 * x[9];
  79. else max += x[9];
  80. }
  81. }
  82. else
  83. {
  84. if (x[9] <= 30)
  85. {
  86. if (x[8] == 10 && x[7] == 10)
  87. {
  88. max += 30 + x[9];
  89. }
  90. else
  91. {
  92. if (x[8] == 10) max += 20 + x[9];
  93. else max += x[9];
  94. }
  95. }
  96. }
  97. }
  98. cout << min << ' ' << max;
  99. return 0;
  100. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement