hinagawa

13(ПП)

Sep 28th, 2020 (edited)
854
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. using namespace std;
  2. #include <iostream>
  3. #include <omp.h>
  4.  
  5. int main()
  6. {
  7.     int a[30] = { 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1 };
  8.     int sum = 0;
  9. #pragma omp parallel shared(a)
  10.     {
  11. #pragma omp for
  12.         for (int i = 0; i < 30; i++)
  13.         {
  14.             sum += a[i] * (30 - i);
  15.         }
  16.     }
  17.  
  18.  
  19.     cout << "The number is:" << sum << endl;
  20.  
  21. }
  22.  
Add Comment
Please, Sign In to add comment