Advertisement
kadeyrov

Untitled

Oct 2nd, 2020 (edited)
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.81 KB | None | 0 0
  1. //
  2. //  main.cpp
  3. //
  4. //  Created by Kadir Kadyrov on 08.07.2020.
  5. //  Copyright © 2020 Kadir Kadyrov. All rights reserved.
  6. //
  7.  
  8. #include <iostream>
  9. #include <algorithm>
  10.  
  11. using namespace std;
  12.  
  13. int main() {
  14.     int n;
  15.     cin >> n;
  16.    
  17.     int ans = 0;
  18.     ans += n / 100;
  19.     n %= 100;
  20.     ans += n / 20;
  21.     n %= 20;
  22.     ans += n / 10;
  23.     n %= 10;
  24.     ans += n / 5;
  25.     n %= 5;
  26.     ans += n;
  27.     cout << ans << endl;
  28. }
  29.  
  30.  
  31.  
  32. //-------------
  33.  
  34. //
  35. //  main.cpp
  36. //
  37. //  Created by Kadir Kadyrov on 08.07.2020.
  38. //  Copyright © 2020 Kadir Kadyrov. All rights reserved.
  39. //
  40.  
  41. #include <iostream>
  42. #include <algorithm>
  43.  
  44. using namespace std;
  45.  
  46. //7
  47. //5 2
  48. // 2 2 3
  49.  
  50. int main() {
  51.     int n;
  52.     cin >> n;
  53.    
  54.     int k = n / 2;
  55.     cout << k << endl;
  56.    
  57.     if (n % 2 == 1) {
  58.         cout << 3 << ' ';
  59.         k--;
  60.     }
  61.    
  62. //    while(k--) {
  63. //        cout << 2 << ' ';
  64. //    }
  65. //    cout << endl;
  66.    
  67.     for (int i = 0; i < k; i++) {
  68.         cout << 2 << ' ';
  69.     }
  70.    
  71.     cout << endl;
  72.    
  73. }
  74.  
  75. //--------------------
  76.  
  77.  
  78. //
  79. //  main.cpp
  80. //
  81. //  Created by Kadir Kadyrov on 08.07.2020.
  82. //  Copyright © 2020 Kadir Kadyrov. All rights reserved.
  83. //
  84.  
  85. #include <iostream>
  86. #include <algorithm>
  87.  
  88. using namespace std;
  89.  
  90. //7
  91. //5 2
  92. // 2 2 3
  93.  
  94. int main() {
  95.     int t;
  96.     cin >> t;
  97.    
  98.     for (int i = 0; i < t; i++) { //while(t--)
  99.         int b, p, f;
  100.         cin >> b >> p >> f;
  101.         int h, c;
  102.         cin >> h >> c;
  103.        
  104.         b /= 2;
  105.         int ans = 0;
  106.         if (h > c) {
  107.             ans += min(b, p) * h;
  108.             b -= min(b, p);
  109.             ans += min(b, f) * c;
  110.         } else {
  111.             ans += min(b, f) * c;
  112.             b -= min(b, f);
  113.             ans += min(b, p) * h;
  114.         }
  115.        
  116.         cout << ans << endl;
  117.     }
  118.    
  119. }
  120.  
  121.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement