Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2020
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4. int main(){
  5. int A[20][20],N,L,C,suma,ok=1,x=1;
  6. ifstream f("bac.txt");
  7. f>>N;
  8. for(int i=1;i<=N;i++)
  9. for(int j=1;j<=N;j++)
  10. f>>A[i][j];
  11. cin>>L>>C;
  12. suma=A[L][C];
  13. while(ok){
  14. if(C+x>N)
  15. break;
  16. suma+=A[L-x][C+x];
  17. x++;
  18. }
  19. x=1;
  20. while(ok){
  21. if(L+x>N)
  22. break;
  23. suma+=A[L+x][C-x];
  24. x++;
  25. }
  26. cout<<suma;
  27. return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement