Advertisement
madidino

teza 8-sub 3-1

Nov 12th, 2023 (edited)
1,127
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 <cmath>
  3. using namespace std;
  4. int n;
  5. void f(int v[11])
  6. {int nr=0;
  7.     for(int i=n;i>=1;i--)
  8.     {
  9.         if(v[i]==1)
  10.         {
  11.             nr+=pow(2,n-i);
  12.         }
  13.     }
  14.     cout<<nr<<" ";
  15. }
  16. int main()
  17. {
  18.     int a[11][11];
  19.     cin>>n;
  20.     for(int i=1;i<=n;i++)
  21.     {
  22.         for(int j=1;j<=n;j++)
  23.         {
  24.             cin>>a[i][j];
  25.         }
  26.         f(a[i]);
  27.     }
  28.     return 0;
  29. }
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement