SelinD

60/133

Jun 28th, 2019
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. #include<iostream>
  2. #include<fstream>
  3. using namespace std;
  4. ifstream fin("bac.txt");
  5. int a[25][25];
  6. int main()
  7. {
  8. int i,j,L,C,n,s=0;
  9. cin>>n;
  10. cin>>L>>C;
  11. for(i=1;i<=n;i++)
  12. for(j=1;j<=n;j++)
  13. cin>>a[i][j];
  14.  
  15. for(i=1;i<=n;i++)
  16. {
  17. for(j=1;j<=n;j++)
  18. {
  19. if(i+j==L+C) s=s+a[i][j];;
  20. }
  21. }
  22. cout<<s;
  23. }
Add Comment
Please, Sign In to add comment