poj 4022(注意求内部.点的方法,不要想麻烦了)

#include<iostream>
#include<cstdio>
using namespace std;
const int maxn = 105;
int main(){
    int h,w;
    double sum=0;
    bool count;
    char c[maxn];
    scanf("%d%d",&h,&w);
    for(int i=0;i<h;i++){
        count = false;
        scanf("%s",c);
        for(int j=0;j<w;j++){
            if(c[j]=='/'||c[j]=='\\'){
                sum += 0.5;
                count = !count;
            }
            else if(c[j]=='.'){
                if(count)
                    sum += 1;
            } 
        }
    }
    printf("%.0lf\n",sum);
    return 0;
}

 

posted @ 2021-08-02 23:12  智人心  阅读(36)  评论(0)    收藏  举报