krasi1105

Untitled

Nov 20th, 2017
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.54 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3.  
  4. int main()
  5. {
  6.     const int boatCount = 35;
  7.     double arr[boatCount], sum = 0, smallest = DBL_MAX;
  8.     int count = 0;
  9.     for (int i = 0; i < boatCount; i++)
  10.     {
  11.         std::cin >> arr[i];
  12.         sum += arr[i];
  13.         count += arr[i] >= 450 && arr[i] <= 1250;
  14.         if (smallest > arr[i])
  15.         {
  16.             smallest = arr[i];
  17.         }
  18.     }
  19.  
  20.     std::cout << count << std::endl;
  21.     for (int i = 0; i < boatCount; i++)
  22.     {
  23.         if (arr[i] == smallest)
  24.         {
  25.             std::cout << i << ' ';
  26.         }
  27.     }
  28.  
  29.     double avg = sum / boatCount;
  30.     std::cout << std::endl << avg << std::endl;
  31.     return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment