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;
}

Android Studio中把llama.cpp编译Android .so 本文介绍了一个在Android Studio中集成llama.cpp的最小Demo实现方案,通过JNI将llama.cpp编译为Android.so库,实现本地加载GGUF模型进行文本生成。文章详细说明了项目结构配置(SDK≥30,NDK≥28)、CMake编译设置、Kotlin-JNI-C++的完整调用链实现,以及模型文件部署方式。该Demo采用每次请求新建上下文的简化设计,包含加载模型、生成文本、资源释放等核心功能,并提供了错误排查建议。项目舍弃了上下文保持等复杂功能以确保稳定性,适合作为端侧大语言模型 阅读详情

相关推荐

STM32L476低功耗实战:LPTIM精准定时唤醒STOP2模式与系统级功耗优化

本文深入探讨了STM32L476低功耗实战技巧,重点解析了LPTIM精准定时唤醒STOP2模式的配置与优化。通过详细的步骤指南和实战经验分享,帮助开发者实现系统级功耗优化,特别适合电池供电设备开发。文章涵盖LPTIM1定时器配置、STOP2模式进入流程及常见问题排查,助力将整机功耗降至8.2uA级别。

weixin_33686714的博客 435

HUT-XXXX DNA-AND-DNA 贪心

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

weixin_34195142的博客 3475

稳定性性能系列之五——Native Crash深度分析:工具实战

深入理解Native Crash的机制与分析方法,掌握addr2line、ndk-stack、gdb等核心工具的实战使用,学会从Tombstone文件中快速定位问题根因

Cheson的专栏 1547

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的博客 3419

C++ 类

本文介绍了C++中类的核心概念和使用方法。

weixin_54859557的博客 1016

iOS逆向实战:绕过SSL Pinning抓取ChatGPT设备令牌

在移动应用安全与网络协议分析领域,中间人攻击是一种核心的流量拦截与分析技术。其原理是在客户端与服务器之间插入一个代理节点,通过伪造数字证书来解密和窥探HTTPS加密流量。这项技术的工程价值在于,它使开发者能够调试API、分析通信协议以及实现自动化集成。然而,许多高安全要求的应用(如金融、社交类App)会采用SSL Pinning(证书绑定)技术来抵御此类攻击,这为逆向工程带来了挑战。本文聚焦于一个具体的应用场景:如何针对启用了SSL Pinning的ChatGPT iOS客户端,通过特定的工具链(如Trol

weixin_28235889的博客 976

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的博客 9985

知识图谱构建中的数据清洗:AI原生应用高质量图谱的前提

数据清洗是知识图谱构建的核心前置环节,直接决定AI原生应用(如智能问答、个性化推荐、决策支持系统)的图谱质量与应用效能。本文以第一性原理为起点,系统解析数据清洗的理论框架、技术架构与工程实践,覆盖从多源异构数据的噪声检测到高质量知识三元组(实体-关系-实体)生成的全流程。通过层次化概念映射(专家→中级→入门)、数学形式化建模及工业级案例分析,揭示数据清洗在解决实体歧义、关系冲突、结构不一致等关键问题中的技术逻辑,并展望基于大模型的智能清洗范式演化。Completeness(完整性)

移动开发前沿的博客 404

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

Android 13 内置xapk安装包的方法

安装xapk 内置xapk

安卓兼职framework和app工程师的博客 224

6、业务影响分析(BIA)的数据收集与关键指标评估

本文全面解析了业务影响分析(BIA)的核心内容,包括数据收集、业务流程分析、信息系统与资产清单、人员与供应商依赖、影响声明、关键指标评估(如MTD、RTO、RPO)、威胁建模与风险分析等。通过详细的介绍和图表展示,帮助组织系统性地制定灾难恢复计划,以应对各种潜在风险,确保关键业务流程在灾难发生后能够快速恢复并持续运营。

moss5的博客 374

../../..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万+

断层错动和近断层地震动联合作用下软岩隧洞衬砌损伤分析

摘要 本文提出了一种基于Python的软岩隧洞衬砌损伤分析系统,重点研究断层错动和近断层地震动的联合作用效应。系统采用有限元方法建立隧洞-围岩体系模型,通过非线性动力分析评估衬砌结构损伤。研究内容包括:1)建立考虑应变软化的软岩本构模型;2)基于位错理论模拟断层错动过程;3)合成具有速度脉冲效应的近断层地震动;4)开发完整的动力响应分析流程。结果表明,所提出的方法能有效评估软岩隧洞在复杂地质条件下的抗震性能,为工程设计提供理论依据。 关键词:软岩隧洞、断层错动、近断层地震动、损伤分析、Python、有限元法

max500600的博客 843

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万+

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

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

蓝牙模块HM-10手册

蓝牙模块HM-10手册,该手册对蓝牙模块HM-10进行了详细的介绍和使用方法以及一些AT指令。

【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万+

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

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、付费专栏及课程。

余额充值