Advertisement
Guest User

Untitled

a guest
Mar 25th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. using namespace std;
  4. char mas[1000][1000];
  5. int main()
  6. {  
  7.     int j=0;
  8.     int i=0;
  9.     int M=0;
  10.     int N=0;
  11.     int kol=0;
  12.     cin>>M;
  13.     cin>>N;
  14.     for(i=0;i<M;i++){
  15.         for(j=0;j<N;j++){
  16.             cin>>mas[i][j];
  17.         }
  18.  
  19.     }
  20.         for(i=0;i<M;i++){
  21.         for(j=0;j<N;j++){
  22.             cout<<mas[i][j];
  23.         }
  24.         cout<<"\n";
  25.     }
  26.  
  27.     for(i=0;i<M;i++){
  28.         for(j=0;j<N;j++){
  29.             if(mas[i][j]=='.'&&mas[i][j+1]=='.'){
  30.                 kol++;
  31.             }
  32.         }
  33.     }
  34.     for(i=0;i<N;i++){
  35.         for(j=0;j<M;j++){
  36.             if(mas[j][i]=='.'&&mas[j+1][i]=='.'){
  37.                 kol++; 
  38.                
  39.             }
  40.         }
  41.     }
  42.     cout<<kol;
  43.     return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement