Advertisement
KiK0S

Untitled

Feb 15th, 2021
639
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.94 KB | None | 0 0
  1. // 1.cpp
  2. #include <iostream>
  3. #include <vector>
  4.  
  5. using namespace std;
  6.  
  7. int main() {
  8.     int n;
  9.     cin >> n;
  10.     vector<int> a(n);
  11.     for (int i = 0; i < n; i++) {
  12.         a[i] = rand() % 141 + 10;
  13.     }
  14.     int sum = 0;
  15.     for (int i = 0; i < n; i++) {
  16.         sum += a[i];
  17.     }
  18.     if (sum < 20) {
  19.         cout << "Недогруз: ";
  20.     } else if (sum > 750) {
  21.         cout << "Перегруз: ";
  22.     } else {
  23.         cout << "ОК: ";
  24.     }
  25.     for (int i = 0; i < n; i++) {
  26.         cout << a[i] << " ";
  27.     }
  28.     return 0;
  29. }
  30.  
  31. // 2.cpp
  32. #include <iostream>
  33.  
  34. using namespace std;
  35.  
  36. int main() {
  37.     int n;
  38.     cin >> n;
  39.     int sum = 0;
  40.     for (int i = 0; i < n; i++) {
  41.         int x;
  42.         cin >> x;
  43.         if (x > 99 || x < 10) {
  44.             continue;
  45.         }
  46.         sum += x / 10;
  47.     }
  48.     cout << sum << '\n';
  49.     return 0;
  50. }
  51.  
  52. // 3.cpp
  53. // ошибка в примерах из условия?
  54. #include <iostream>
  55.  
  56. using namespace std;
  57.  
  58. int main() {
  59.     int a, b;
  60.     cin >> a >> b;
  61.     cout << a + b * 50 << '\n';
  62.     return 0;
  63. }
  64.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement