UVa 414 Machined Surfaces (water ver.)

C++: error: bitwise operation between different enumeration types (‘xxx‘ and ‘bbb’) is deprecated 新的版本里c++20默认,不让做不同enum类型的比较,转换。这是一个避免错误的方法,应该建议使用。而且这种问题调试的时候,非常困难。 阅读详情

414 - Machined Surfaces

Time limit: 3.000 seconds

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=94&page=show_problem&problem=355

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 XXXXX tex2html_wrap_inline50

XXX XXXXXXX

XXXXX XXXX

XX XXXXXX

. .

. .

. .

XXXX XXXX

XXX XXXXXX tex2html_wrap_inline52

tex2html_wrap_inline54 tex2html_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  Nwill 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


学英语:

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.

对所给的每幅图像,你要去查明当左表面接触到右表面后所存在的“空隙”总数。


完整代码:

/*0.009s*/

#include<cstdio>
#include<algorithm>
using namespace std;

int main(void)
{
	int N, sum, minb, temp;
	char c;
	while (scanf("%d", &N), N)
	{
		getchar();
		sum = 0;
		minb = 10000;
		for (int i = 0; i < N; i++)
		{
			temp = 0;
			while (true)
			{
				c = getchar();
				if (c == ' ')
				{
					sum++;
					temp++;
				}
				else if (c == '\n')
				{
					minb = min(minb, temp);
					break;
				}
			}
		}
		printf("%d\n", sum - minb * N);
	}
	return 0;
}

vivado 编译ADI AD9361 TCL脚本生成hdl工程 (4)输入"source ../../scripts/adi_make.tcl"命令(仅双引号内部命令,不包含双引号),个人理解:该命令用来加载当前所需要编译工程所需要各功能模块的信息,因为每个工程需要不同的功能模块,比如有的需要gpio模块,有的不需要gpio模块,这些模块上前面路径的library也同样以TCL脚本形式存在,当有需要时才进行编译,怎么知道当前工程需要什么模块呢就是通过"source ../../scripts/adi_make.tcl"(仅双引号内部命令,不包含双引号)命令实现。 阅读详情

相关推荐

hcaptcha无感验证码逆向实战:从接口分析到环境补全

本文详细解析了hcaptcha无感验证码的逆向实战过程。通过分析核心接口与加密逻辑,重点介绍了采用环境补全策略来模拟真实浏览器环境,从而绕过验证码检测。文章提供了从接口抓包、剖析hsw.js加密核心到使用Node.js搭建模拟环境的完整步骤,为自动化操作提供了一种稳健的解决方案。

weixin_29324401的博客 1156

HUT-XXXX DNA-AND-DNA 贪心

对于一个串,我们可以这样考虑,首先我们从串的最后面开始向前遍历。 对于一个串是 "XXXXAA",那么对于后面这两个A,我们是不用做任何考虑的,我们甚至可以直接认为这个串没有后面这两位。 对于一个串是 "XXXXBB",那么我们是一定要选择反转的,因为单次操作的话将这两个(或者多个)B变成A需要两次操作,而我们通过翻转整个串,再翻转前N-2个串同样可以达到这个效果。但是我们翻转整个串可能为前面...

weixin_34195142的博客 3475

Python小白也能玩转迅投QMT量化交易?手把手教你从安装到第一个策略

本文为零基础Python用户提供了上手迅投QMT量化交易平台的完整指南。从Python 3.6环境配置、QMT客户端获取安装,到核心概念讲解,并手把手教你编写并回测一个经典的双均线交易策略,帮助初学者快速迈出量化交易的第一步。

weixin_29103191的博客 763

414 - Machined Surfaces

Machined Surfaces An imaging device furnishes digital images of two machined surfaces that eventually will be assembled in contact with each other. The roughness of this fin...

weixin_30784501的博客 3420

FPGA之VGA转HDMI之编码模块的编写

VGA 图像信息到 HDMI 图像信息的转化需要对输入的 VGA 图像信息进行编码、并行串行转换、单端信号转差分信号、单沿采样转双沿采样。 其中,编码模块就是为了完成 VGA 图像数据 8b 转 10b 的编码。其结构框图如下所示: 图1 编码模块框图 图2 编码模块输入输出信号功能框图 图3 编码模块参考流程图 图4 编码模块参考流程图参数说明 下面我们依据HDMI官方手册中的流程图(图3)进行 HDMI 8b...

qq_51264805的博客 3024

Android 11系统定制:如何彻底隐藏状态栏电池图标(RK3568实测)

本文详细解析了在Android 11系统上如何通过多维度修改实现状态栏电池图标的彻底隐藏,特别针对RK3568平台提供了实战指南。从系统UI架构解析到核心配置文件修改,再到进阶技巧与疑难排查,帮助开发者深度定制Android系统,满足特定场景需求。

weixin_29250573的博客 376

How to solve the error "Field service in com.xx.xxx.xxxx required a bean of type 'com.aa.bb.cc' that...

When runung a SpringBoot demo, I got a error as following: *************************** APPLICATION FAILED TO START *************************** Description: Field service in com.hy.emp...

weixin_30813225的博客 9986

解决Calibre中license的错误

本次解决了Calibre在Cadence 617 virtuoso版本中运行不了的错误,在遇到问题的时候,我也跟你们一样,首先是上网查询为什么运行不了呢?明明我安装了之后里面有Calibre的,我当时也是这样的疑惑,一点Calibre运行LVS的时候,一片空白,然后就出现了license的错误,后来点点点,看看看,搜搜搜,最终解决了这个问题。虚拟机是VMware16版本,cadence617,Calibre是2015版本。旨在记录遇到的实际问题。

yytu231的博客 1万+

uva 414 - Machined Surfaces

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

uva code 5014

OsgEarth —— 笔记1 - 创建地球的earth文件

效果         正文      1、准备一张全球的渲染图(tif格式)、一张全球的高程图(tif格式)        2、创建并编写.earth文件           在步骤1目录下创建china-simple.earth,并将如下内容写入。 <map name="Globe" type="geocentric" version="2"> <!-- 全球影像图 --> <image name="GlobeImage" driver="gdal"> &l

7681

innovus获取mem pin shape box脚本

innovus mem 的pin shae只能通过attitude editor看属性获取其pin shape的box,但是想用脚本处理一定box时,没有别的办法能直接获取box属性。我正在「拾陆楼」和朋友们讨论有趣的话题,你⼀起来吧?

m0_61544122的博客 1108

../../..xxx.go:46:18: aa.Bbb undefined (type *"xx/xxx/xx".Ccc has no field or method Bbb)

golang 程序编译时突然报这个错 ../../..xxx.go:46:18: aa.Bbb undefined (type *"xx/xxx/xx".Ccc has no field or method Bbb) 找到 xxx.go 文件的第 46 行(18是列号),aa.Bbb 当前应该是处于标红未定义的状态,排查为啥 Bbb 未定义即可。 ...

Lucky小黄人的博客 13万+

ResNet改进(50):SKConv和CBAM增强的ResNet模型

动态调整感受野大小- 结合通道和空间注意力模型的核心思想是在ResNet的每个残差块后插入这些注意力模块,使网络能够自适应地关注更重要的特征。模型的核心是类,它在标准ResNet34的基础上:替换了初始卷积层,使用更小的核(3×3)和步长(1)在每个残差块后选择性添加SKConv和CBAM模块# 加载预训练ResNet34# 自定义初始层# 添加注意力机制的残差层通过集成SKConv和CBAM,这个改进的ResNet模型能够更有效地捕捉多尺度特征并关注关键信息区域。

2401_82355416的博客 621

failed to allocate XXXX bytes for committing reserved memory.

# # There is insufficient memory for the Java Runtime Environment to continue. # Native memory allocation (malloc) failed to allocate 2863333376 bytes for committing reserved memory. # Possible reason

Flyer的后花园 2万+

大中型超市收银系统(可直接运行)

光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.net 4.0登陆信息用户名:1001 密码:123456内置商品信息,商品编码可输入00001000 - 00010000,测试效果相关功能键F5 结算 F9挂单 F11商品查询 F8退货 Insert单品取消 Del整单取消 F12开钱箱F2 会员 Ctrl+Z退出系统 Home 锁屏 相关源码待公开

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

Machined Surfaces

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.

no ACMer 7975

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

【UVA】【第0章】414 - Machined Surfaces

Machined Surfaces  An imaging device furnishes digital images of two machined surfaces thateventually will be assembled incontact with each other. The roughness of this final contact is to

求拿1= 3万+

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

02_UVaOJ_ AOAPC I_Beginning Algorithm Contests (Rujia Liu)_Volume0_Getting Started

刘汝佳白书推介(第01~04章相关UVaOJ题目练习) Root :: AOAPC I: Beginning Algorithm Contests (Rujia Liu) :: Volume 0. Getting Started 内容包括:题目列表,相关题目的.cpp(题目,分析,代码) 题目难度参考于:http://www.cnblogs.com/devymex/archive/2

Neicole ~~ 学习旅程(大学) 29万+

HEAP: Free Heap block XXXX modified at XXXX after it was freed

*本文旨在解决在调试过程中遇到如下问题时的解决办法: HEAP: Free Heap block XXXXA modified at XXXXB after it was freed 意思是:已经释放的内存地址A,在B地址处的值被改变(A和B都处于被释放的内存段内),即很可能出现了野指针,而很多情况下你会说,我的每个new和delete都是成对的,在delete后将指针赋值为NULL。但是

ylj135cool的博客 201万+

[解题报告]Machined Surfaces

题目大意 题目原文:http://uva.onlinejudge.org/external/4/414.pdf 背景 输入一个n代表下面有n行,当输入n时,结束程序,每行都有25个字符都以x开头和结尾,计算出 总的空格数 - 最少空格数*行数n Sample Input(为了便于观看,下面的B代表空格) 4XXXXBBBBBBBBBBBBBBBBXXXXXXXXBBBBBB...

weixin_34344403的博客 1万+

Maven:Description Resource Path Location Type Archive for required library 错误

Description Resource Path Location Type Archive for required library"aaa/bbb/xxx.jar"  cannot be read or is not a valid ZIP file  解决办法:删除"aaa/bbb/"目录下的所有文件,然后右击项目-maven-update project即可。 ...

WJY329的博客 4681

Educational Codeforces Round 62 (Rated for Div. 2) - E.Palindrome-less Arrays(dp)

题目大意:给你一个串,这个串有-1或1~k中的数组成,-1位置的数未确定,你可以将1~k中的数填入其中。问有多少种填的方案使得这个串中不包含回文串 思路:这道题看的时候就感觉是dp,不过搞了很长时间没搞出来(菜哭)。看了cf官方的题解后恍然大悟。 首先需要知道只要长度为3的串不是回文串,那么包含这个长度为3的串的较长的串一定不是回文串(这个很好理解) 所以我们只需消灭长度为3的回文串。...

star_moon0309的博客 1万+

Yocto skip bb files : BBMASK

MASK bitbake https://stackoverflow.com/questions/48224871/make-yocto-skip-a-recipe-instead-of-stopping You can find more information in the documentation for that variable: https://www.yoctoproject...

行者无疆 2880

Ubuntu常用命令大全

Ubuntu常用命令大全 查看软件xxx安装内容#dpkg -L xxx 查找软件#apt-cache search 正则表达式查找文件属于哪个包#dpkg -S filename apt-file search filename 查询软件xxx依赖哪些包#apt-cache depends xxx 查询软件xxx被哪些包依赖#apt-cache rdepends xxx 增加一个光盘...

cxianf 2215

svn: Aborting commit: '/aaa/bbb/xxxxxxxx' remains in conflict解决方法

$ svn commit -m "zzzzzzzz" svn: Commit failed (details follow): svn: Aborting commit: '/aaa/bbb/xxxxxxxx' remains in conflict 以上是有冲突了,解决方法如下: “手动”合并冲突文本(检查和修改文件中的冲突标志)。 用某一个临时文件覆盖你的工作文件。 运行svn r

matthew0618band的专栏 1万+

UVa 414 Machined Surfaces

Machined Surfaces An imaging device furnishes digital images of two machined surfaces that eventually will be assembled in c...

weixin_30679823的博客 2118
上一篇: UVa 494 Kindergarten Counting Game (字符串处理)
下一篇: UVa 524 Prime Ring Problem (数论&DFS)
synapse7
博客等级 码龄14年 432粉丝 701原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值