uva 414 Machined Surfaces

摘要:
D加工表面时间限制:3000MS内存限制:0KB64位IO格式:%lld&%lllSubmitStatusPracticeUVA414约会描述:系统爬行器(2016-03-11)描述动画设备提供机器的数字图像
D - Machined Surfaces
Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu
Appoint description: 

Description

Download as PDF
 

An imaging device furnishes digital images of two machined surfaces that eventually will be assembled in contact with each other. The roughness of this final contact is to be estimated.

A digital image is composed of the two characters, "X" and " " (space). There are always 25 columns to an image, but the number of rows, N, is variable. Column one (1) will always have an "X" in it and will be part of the left surface. The left surface can extend to the right from column one (1) as contiguous X's.

Similarly, column 25 will always have an "X" in it and will be part of the right surface. The right surface can extend to the left from column 25 as contiguous X's.

Digital-Image View of Surfaces

 Left     		                           Right

XXXX XXXXXtex2html_wrap_inline50

XXX XXXXXXX

XXXXX XXXX

XX XXXXXX

. .

. .

. .

XXXX XXXX

XXX XXXXXXtex2html_wrap_inline52

tex2html_wrap_inline54tex2html_wrap_inline56

1 25

In each row of the image, there can be zero or more space characters separating the left surface from the right surface. There will never be more than a single blank region in any row.

For each image given, you are to determine the total ``void" that will exist after the left surface has been brought into contact with the right surface. The ``void" is the total count of the spaces that remains between the left and right surfaces after theyhave been brought into contact.

The two surfaces are brought into contact by displacing them strictly horizontally towards each other until a rightmost "X" of the left surface of some row is immediately to the left of the leftmost "X" of the right surface of that row. There is no rotation or twisting of these two surfaces as they are brought into contact; they remain rigid, and only move horizontally.

Note: The original image may show the two surfaces already in contact, in which case no displacement enters into the contact roughness estimation.

Input

The input consists of a series of digital images. Each image data set has the following format:

First line -
A single unsigned integer, N, with value greater than zero (0) and less than 13. The first digit of N will be the first character on a line.
Next N lines -
Each line has exactly 25 characters; one or more X's, then zero or more spaces, then one or more X's.

The end of data is signaled by a null data set having a zero on the first line of an image data set and no further data.

Output

For each image you receive as a data set, you are to reply with the total void (count of spaces remaining after the surfaces are brought into contact). Use the default output for a single integer on a line.

Sample Input (character "B" for ease of reading. The actual input file will use the ASCII-space character, not "B").

4
XXXXBBBBBBBBBBBBBBBBXXXXX
XXXBBBBBBBBBBBBBBBXXXXXXX
XXXXXBBBBBBBBBBBBBBBBXXXX
XXBBBBBBBBBBBBBBBBBXXXXXX
2
XXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXX
1
XXXXXXXXXBBBBBBBBBBBBBBXX
0

Sample Output

4
0
0


题目非常简单,统计每一行的空格数,用总的空格数减掉最少行的空格数*n,输出结果即可。

免责声明:文章转载自《uva 414 Machined Surfaces》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇click和mousedown的区别什么,kafka能够从follower副本读数据了 —kafka新功能介绍下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

随便看看

ssh登录时在参数中加入密码的解决方案

在使用ssh登录远程服务器的时候,在执行完sshuser@ip后,要输入登录密码,有时候登录密码记不住,这样以来Ian带来的很多的麻烦,有没有一种在ssh的参数中直接加入密码的方法呢?查看ssh的帮助我们发现ssh命令并不能在参数中制定密码。usage:ssh[-1246AaCfGgKkMNnqsTtVvXxYy][-bbind_address][-ccip...

Gradle在Mac上安装及Idea中配置

前言笔者在安装Gradle的过程中发现过程有点繁琐且安装教程比较少,因此记录一下安装过程,方便同行参考环境信息macOS:10.15.5IntelliJIDEA:2020.3Gradle:6.8.2Java:1.8.0_151Homebrew:3.0.1进入Gradle官网点此进入Gradle官网点击安装安装文档包管理安装安装brew本次安装使用brew安装...

Spring Boot 核心配置文件 bootstrap & application

boostrap由父ApplicationContext加载,比applicaton优先加载boostrap里面的属性不能被覆盖3、bootstrap/application的应用场景application配置文件这个容易理解,主要用于SpringBoot项目的自动化配置。这个父级的SpringApplicationContext是先加载的,在加载appli...

Notepad++正则表达式查找替换文本中文字符

测试需求测试工具中xml配置文件中的注释字段包含中文字符。Win10系统中使用的工具中偶尔会出现中文乱码,导致配置文件无效。解决方案是将配置文件中的中文注释替换为英文注释,或者直接替换和删除。如何查找和删除配置文件中的汉字?“记事本”中使用正则表达式[^x00 xff]来匹配汉字。替换完成如下3。所有汉字已被替换。...

【JVM】元空间详解 Metaspace

nocs。JpgNoKlassisMetaspaceNoKlassinMetaspaces专用于存储其他与klass相关的内容,如方法、常量池等。它可以由多个不连续的存储器组成。在元空间GC之后,还将调整阈值。默认情况下,MaxMetaspaceSize基本上是无限的,因为大多数元空间都是在本地内存中分配的,但它仍然受到本地内存大小的限制。为了防止元空间的无...

sqlite3 数据类型 批量插入

SQLite3采用动态数据类型。存储值的数据类型与值本身相关,而不是由其字段类型决定。SQLite3的动态数据类型可以向后兼容其他数据库常用的静态类型,这意味着在使用静态数据类型的数据库中使用的数据表也可以在SQLite3中使用。在SQLite2数据库中,除了声明为主键的INTEGER列外,任何列都可以存储属于任何存储类型的值。...