Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.91 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main(){
  6.   int matt[35][35],v,h,n=-1;
  7.   bool a=false;
  8.   cin>>v;
  9.   cin.ignore();
  10.   cin>>h;
  11.   cin.ignore();
  12.   for(int i=0;i<h;i++){
  13.     string s;
  14.     getline(cin,s);
  15.     for(int j=0;j<v;j++){
  16.       matt[i][j]=s[j]-'0';}}
  17.   for(int i=0;i<h;i++){
  18.     //  cout<<"i"<<endl;
  19.     for(int j=0;j<v;j++){
  20.       cout<<matt[i][j]<<endl;
  21.       if(matt[i][j]==0)                  //ova
  22.     cout<<endl;
  23.       if(matt[i][j]==0){                 //i ova
  24.     cout<<j<<' '<<i<<' ';
  25.     for(int m=j+1;m<v;j++){
  26.       if(matt[i][m]==0){
  27.         a=true;
  28.         cout<<m<<' '<<i<<' ';
  29.         break;
  30.       }
  31.     }
  32.     if(not(a))
  33.       cout<<n<<' '<<n<<' ';
  34.     a=false;
  35.     for(int m=i+1;m<h;m++){
  36.       if(matt[m][j]==0){
  37.         a=true;
  38.         cout<<j<<' '<<m<<endl;
  39.         break;
  40.       }
  41.     }
  42.     if(not(a))
  43.       cout<<n<<' '<<n<<endl;
  44.     a=false;
  45.       }
  46.       else
  47.     a=false;
  48.    
  49.     }
  50.   }
  51.  
  52.   return 0;}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement