Advertisement
Guest User

D

a guest
Oct 12th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <fstream>
  4.  
  5. using namespace std;
  6.  
  7. int main (){
  8.    
  9. ifstream fin("input.txt");
  10. ofstream fout("output.txt");
  11. int n, arif, stop=0, sum=0;
  12. fin>>n;
  13. int mas[n][n];
  14.  
  15. for(int k=0; k<n; k++)
  16. {
  17.     for(int c=0; c<n; c++)
  18.     {
  19.         fin>>mas[k][c];
  20.    
  21.     }
  22.    
  23. }
  24. arif=(1+n)*n/2;
  25.  
  26. for(int k=0; k<n; k++)
  27. {
  28.     for(int c=0; c<n; c++)
  29.     {  
  30.         sum+=mas[c][k];
  31.    
  32.     }
  33.         if(sum==arif)
  34.         stop++;
  35.         sum=0;
  36. }
  37. fout<<stop;
  38.  
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement