fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3. int main() {
  4. int n;
  5. cin>>n;
  6. int a[n][n]={};
  7. for(int i=0; i<n; i++)
  8. for(int j=0; j<n; j++)
  9. cin>>a[i][j];
  10. for(int i=0; i<n; i++)
  11. for(int j=i+1; j<n; j++)
  12. if(a[i][j]==1) cout<<i+1<<' '<<j+1<<endl;
  13.  
  14. }
Success #stdin #stdout 0.01s 5284KB
stdin
5
0 0 1 0 0 
0 0 1 0 1 
1 1 0 0 0 
0 0 0 0 0 
0 1 0 0 0 
stdout
1 3
2 3
2 5