Advertisement
Andrey_ZoZ

M

Sep 4th, 2020
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. #include<iostream>
  2. #include <iomanip>
  3. int main()
  4. {
  5.     int count;
  6.     std::cin>>count;
  7.     count=abs(count);
  8.     double* massive=new double[count];
  9.     for (int index{1}; index<=count; ++index) {
  10.         std::cin>>massive[index];
  11.     }
  12.     int times{0};
  13.     double sum{0};
  14.     for (int index{3}; index<count; index+=3) {if(massive[index]>0){sum+=massive[index];++times;}}
  15.     std::cout<<times<<" "<<std::setprecision(3)<<sum;
  16. }
  17.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement