博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Codeforces 549A. Face Detection[模拟]
阅读量:4559 次
发布时间:2019-06-08

本文共 1994 字,大约阅读时间需要 6 分钟。

A. Face Detection
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

The developers of Looksery have to write an efficient algorithm that detects faces on a picture. Unfortunately, they are currently busy preparing a contest for you, so you will have to do it for them. 

In this problem an image is a rectangular table that consists of lowercase Latin letters. A face on the image is a 2 × 2 square, such that from the four letters of this square you can make word "face". 

You need to write a program that determines the number of faces on the image. The squares that correspond to the faces can overlap.

Input

The first line contains two space-separated integers, n and m (1 ≤ n, m ≤ 50) — the height and the width of the image, respectively.

Next n lines define the image. Each line contains m lowercase Latin letters.

Output

In the single line print the number of faces on the image.

Examples
input
4 4 xxxx xfax xcex xxxx
output
1
input
4 2 xx cf ae xx
output
1
input
2 3 fac cef
output
2
input
1 4 face
output
0
Note

In the first sample the image contains a single face, located in a square with the upper left corner at the second line and the second column: 

In the second sample the image also contains exactly one face, its upper left corner is at the second row and the first column.

In the third sample two faces are shown: 

In the fourth sample the image has no faces on it.


题意:四个格子里出现face四个字母


我是用了个vis数组,题解是给四个格子字母排序与acef对比

////  main.cpp//  cf549a////  Created by Candy on 9/15/16.//  Copyright © 2016 Candy. All rights reserved.//#include 
#include
#include
#include
using namespace std;const int N=55;int n,m,ans=0;int a[N][N],vis[30];char s[N];int main(int argc, const char * argv[]) { scanf("%d%d",&n,&m); for(int i=1;i<=n;i++){ scanf("%s",s); for(int j=0;j

 

 

 

转载于:https://www.cnblogs.com/candy99/p/5877454.html

你可能感兴趣的文章
一些容易出错的细节
查看>>
XE: Changing the default http port
查看>>
IDEA 用了maven后的 智能提示 不出现问题,项目的依赖包没有加载依赖库中的问题。...
查看>>
MySQL一查就会
查看>>
luogu 1273有线电视网
查看>>
android之RefBase
查看>>
将多层级xml解析为Map
查看>>
从零开始学Go之容器(四):列表
查看>>
结对作业--项目之需求分析
查看>>
转 Learning To Rank之LambdaMART的前世今生
查看>>
继续(三)
查看>>
codeforces365B
查看>>
Xcode 代码块
查看>>
浅谈iOS7 AVFoundation 二维码扫描
查看>>
[CLR via C#]17. 委托
查看>>
【目录】集合框架目录
查看>>
SQL SERVER行转换列及PIVOT
查看>>
no pointer in java
查看>>
iperf安装与使用
查看>>
【斜率DP】BZOJ 1010:玩具装箱
查看>>