MS Recognition

在线提交:

hihoCoder 1402 http://hihocoder.com/problemset/problem/1402

类似:

OpenJudge - I:PKU Zealots http://poj.openjudge.cn/campus2016/I/

描述

Given an image containing only two kinds of capital letters, ‘M’ and

‘S’, can you tell how many of each letter are there in the image? Note

that the letters may be of different sizes and may be rotated.

输入

The first line contains two integers H and W, indicating the height

and weight of the image. (1 <= H, W <= 500)

Then follows an H x W matrix indicating the image.

‘.’ indicates the pixel is empty and ‘#’ indicates the pixel is part

of a letter.

It is guaranteed that:

  1. The letters are actually in Microsoft Yahei font.

  2. Each letter consists of at least 20 pixels.

  3. Different letters are at least 2 pixels away from each other.

输出

Two integers, the number of ‘M’ letters and the number of ‘S’ letters.

样例输入

50 50

………………………………………………

……………………………………………….

……………………………………….#…….

………………………..###……….##…….

…….##………………##.##…….#………

…….##………………#…………##………

……###…….#……….#………..##………

……####…..###………###…….######…

……#.##…..###……….####……………#…

……#.##….####…………##…………..#…

…..##..#…##.#………..#…#…………##…

…..##..#..##.##……..#####……….##…..

…..#…#.##..##……………………………

…..#…###…#…………………………….

…..#…###…#…………………………….

………##…##………………….##……….

…………..##…..##…………..###……….

………………..###…………###…………

……………….###………….##………….

………………###………….##…………..

……………..###…………..##…………..

…………….###……###…….########…….

……………###…..#####……..########……

…………..###…########……………##…..

………….###..#####..##…………….##…..

…………########….###…………….##…..

………..#######……##…..##………###…..

…………###………##….###…….####……

…………………..###…###…….###……..

…….#……………##…###……………….

…..####………….###..###………………..

…######………….##..###…………………

..####…………….######………………….

..###…………….######…………………..

.###……………..#####…….##……………

.###…………….#####……..######………..

.###……………..###………##########…….

..##########…………………..##…####……

..############………………….##…………

….###########………………….###……….

………….##…………………..###………

………….###…………………..###……..

………….###……………….#######……..

………….##…………….########………..

…………###…………….####……………

……….####………………######…………

…….######………………….######………

…….###………………………..##………

…………………………………………..

…………………………………………..

输入的图形变形了,下面附上截图:

样例输出

3 4

思路:

参考:

2017微软秋季校园招聘在线编程笔试4——1402 : MS Recognition - 简书

https://www.jianshu.com/p/6957bc1664f1

我来贴一个第四题的思路 - hihoCoder

http://hihocoder.com/discuss/question/3970

C# - 2017微软校园招聘笔试题 之 MS Recognition[待解决]的更多相关文章

  1. 2014 WAP校园招聘笔试题

    2014 WAP校园招聘笔试题 Problem's Link:   http://www.doc88.com/p-6751117015483.html WAP公司笔试题 We are planning ...

  2. google2013校园招聘笔试题(全国)

    google2013校园招聘笔试题 1. 单项选择题1.1如果把传输速率定义为单位时间内传送的信息量(以字节计算)多少.关于一下几种典型的数据传输速率:1.使用USB2.0闪存盘,往USB闪存盘上拷贝 ...

  3. Microsoft 2013校园招聘笔试题及解答

    Microsoft 2013校园招聘笔试题及解答 题目是自己做的,求讨论.吐槽.拍砖 1.      Which of the following callingconvension(s) suppo ...

  4. Microsoft2013校园招聘笔试题

    Microsoft2013校园招聘笔试题 继续求拍砖!!!! 1. You are managing the database of a book publichser, you currently ...

  5. 京东2017校园招聘笔试题 【第K个幸运数】

    题目描述 4和7是两个幸运数字,我们定义,十进制表示中,每一位只有4和7两个数的正整数都是幸运数字. 前几个幸运数字为:4,7,44,47,74,77,444,447... 现在输入一个数字K,输出第 ...

  6. 九度OJ 1531 货币面值(网易游戏2013年校园招聘笔试题) -- 动态规划

    题目地址:http://ac.jobdu.com/problem.php?pid=1531 题目描述: 小虎是游戏中的一个国王,在他管理的国家中发行了很多不同面额的纸币,用这些纸币进行任意的组合可以在 ...

  7. PPS2013校园招聘笔试题

    转载请标明出处,原文地址:http://blog.csdn.net/hackbuteer1/article/details/11473405 一.简答题 (1)一位老师有2个推理能力很强的学生,他告诉 ...

  8. Microsoft2013校园招聘笔试题及解答

    继续求拍砖!!!! 1. You are managing the database of a book publichser, you currently store the book orders ...

  9. 2012Google校园招聘笔试题

    1.已知两个数字为1~30之间的数字,甲知道两数之和,乙知道两数之积,甲问乙:“你知道是哪两个数吗?”乙说:“不知道”.乙问甲:“你知道是哪两个数吗?”甲说:“也不知道”.于是,乙说:“那我知道了”, ...

随机推荐

  1. Adams 2013自定义插件方法zz

    1.Adams插件介绍 Adams的高级模块(如Controls控制模块.Vibration振动模块.Durability耐久性模块等)是以插件的形式集成在Adams软件中.通过Adams提供的插件管 ...

  2. [转]HTML5 script 标签的 crossorigin 属性到底有什么用?

    HTML5 script 标签的 crossorigin 属性到底有什么用? 最近Bootstrap 4已经正式发布了,可能已经有爱尝鲜的小伙伴在 alpha 阶段就尝试过 BS4.不过今天要说的不是 ...

  3. 第三方布局框架Neon初探

    github地址:https://github.com/mamaral/Neon 居中 设置 view 在 superview 的中心,调用 anchorInCenter()并设置view大小,相当于 ...

  4. python+matplotlib+绘制不同图标类型

    #==================================================================#首先需要导入两个文件import matplotlib.pypl ...

  5. [开源]使用C# 对CPU卡基本操作封装

    Github 地址:https://github.com/zifeiniu/CPUCardLib 项目需求及简介: 公司要求将用户相关的信息储存到射频卡中,之前项目使用的Mifare类型卡,只储存了用 ...

  6. Oracle导入数据无法导出空表的问题

    Oracle 11G在用export导出时,空表不能导出,11G R2中有个新特性,当表无数据时,不分配segment,以节省空间. 那么我们应该如何导出空表: 利用如下语句生成alter语句,未每个 ...

  7. markdown 书写文档的框架

    请使用 [MkDocs](http://www.mkdocs.org/)

  8. iptv

    # -*- coding: utf-8 -*- import datetime, time, json, re, os #from pwd import getpwnam #quality str_q ...

  9. vijos搭建踩坑

    nodejs我用的8.x版本,可以工作. 和制作组交谈之后他们说最好榨汁机和主机不要在同一系统下. vj4/vj4/handler/base.py的第343行 从 super(Connection, ...

  10. CSS水平垂直居中!

    总结一下,最经典的面试题 分两种情况,宽高确定和不定宽高 (一)宽高确定 初始条件如下: 1. 绝对定位 + 负margin 里面的盒子相对于父盒子绝对定位,距离上面和左边分别为50%,此处的50%是 ...