码迷,mamicode.com
首页 > 其他好文 > 详细

ZOJ 2975: Kinds of Fuwas

时间:2017-07-30 01:01:10      阅读:189      评论:0      收藏:0      [点我收藏+]

标签:return   clu   for   while   emc   class   out   get   lan   

ZOJ 2975:  Kinds of Fuwas

 

///@author Sycamore, ZJNU
///@date 2017-02-07
#include<iostream>
using namespace std;
char mat[250][250];
int main()
{
    int T,M,N;
    cin >> T;
    while (T--)
    {
        cin >> M >> N;
        int c = 0;
        for (int i = 0; i < M; i++)
            for (int j = 0; j < N; j++)
                cin >> mat[i][j];
        if(M-1&&N-1)
        { 
        for(int top=0;top<M-1;top++)
            for(int left=0;left<N-1;left++)
                for (int bottom = top+1; bottom < M; bottom++)
                {
                    if (mat[top][left] == mat[bottom][left])
                    {
                        for (int right = left+1; right < N; right++)
                        {
                            if (mat[top][left] == mat[top][right] && mat[bottom][left] == mat[bottom][right])
                                c++;
                        }
                    }
                }
                
        }
        cout << c << endl;
    }
    return 0;
}

 

ZOJ 2975: Kinds of Fuwas

标签:return   clu   for   while   emc   class   out   get   lan   

原文地址:http://www.cnblogs.com/zjnu/p/7257963.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!