Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- int main(){
- int A[20][20],N,L,C,suma,ok=1,x=1;
- ifstream f("bac.txt");
- f>>N;
- for(int i=1;i<=N;i++)
- for(int j=1;j<=N;j++)
- f>>A[i][j];
- cin>>L>>C;
- suma=A[L][C];
- while(ok){
- if(C+x>N)
- break;
- suma+=A[L-x][C+x];
- x++;
- }
- x=1;
- while(ok){
- if(L+x>N)
- break;
- suma+=A[L+x][C-x];
- x++;
- }
- cout<<suma;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement