C# - 2017微软校园招聘笔试题 之 MS Recognition[待解决]

本文介绍了一个图像识别问题MSRecognition,任务是在包含大写'M'和'S'的图像中识别这两种字母的数量。输入为图像的高度和宽度及像素矩阵,输出为'M'和'S'的数量。文章提供了样例输入输出,并附带了解题思路。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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
………………………………………………
……………………………………………….
……………………………………….#…….
………………………..###……….##…….
…….##………………##.##…….#………
…….##………………#…………##………
……###…….#……….#………..##………
……####…..###………###…….######…
……#.##…..###……….####……………#…
……#.##….####…………##…………..#…
…..##..#…##.#………..#…#…………##…
…..##..#..##.##……..#####……….##…..
…..#…#.##..##……………………………
…..#…###…#…………………………….
…..#…###…#…………………………….
………##…##………………….##……….
…………..##…..##…………..###……….
………………..###…………###…………
……………….###………….##………….
………………###………….##…………..
……………..###…………..##…………..
…………….###……###…….########…….
……………###…..#####……..########……
…………..###…########……………##…..
………….###..#####..##…………….##…..
…………########….###…………….##…..
………..#######……##…..##………###…..
…………###………##….###…….####……
…………………..###…###…….###……..
…….#……………##…###……………….
…..####………….###..###………………..
…######………….##..###…………………
..####…………….######………………….
..###…………….######…………………..
.###……………..#####…….##……………
.###…………….#####……..######………..
.###……………..###………##########…….
..##########…………………..##…####……
..############………………….##…………
….###########………………….###……….
………….##…………………..###………
………….###…………………..###……..
………….###……………….#######……..
………….##…………….########………..
…………###…………….####……………
……….####………………######…………
…….######………………….######………
…….###………………………..##………
…………………………………………..
…………………………………………..

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

样例输出
3 4

思路:

参考:
2017微软秋季校园招聘在线编程笔试4——1402 : MS Recognition - 简书
https://www.jianshu.com/p/6957bc1664f1

我来贴一个第四题的思路 - hihoCoder
http://hihocoder.com/discuss/question/3970

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

极客白小飞

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值