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

题目很难懂,看了别人的大意是,B代表空格然后右边的向左边压缩知道某一行没有B,统计剩下的空格数,

没有空格就是B最少的一行,所以找住最小的一行空格数,统计所有空格数,然后减去每行的压缩了的空格

#include <stdio.h>
#include <string.h>
void main()
{char s[26];
 int sum,n,i,j,min,l,num;
 while (scanf("%d",&n),n)
 {getchar();
  min=26; sum=0;
  for (i=1;i<=n;i++)
  {gets(s);
   num=0;
   l=strlen(s);
   for (j=0;j<l;j++)
   if (s[j]=='X') ++num;
   num=25-num;
   if (min>num) min=num;
   sum+=num;
  }
  printf("%d\n",sum-n*min);
 }
}

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

相关推荐

DAEMON Tools

xxxsbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb

HUT-XXXX DNA-AND-DNA 贪心

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

weixin_34195142的博客 3482

手把手教你编写PCIe设备驱动:基于Linux内核的实战教程

本文详细介绍了基于Linux内核的PCIe设备驱动开发全流程,包括环境准备、设备探测、中断处理、DMA配置等核心内容。通过实战代码示例和Makefile编写指南,帮助开发者快速掌握PCIe驱动开发技术,实现高性能设备驱动开发与优化。

weixin_30687051的博客 203

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

从PWM到正弦波:RC低通滤波器的魔法转换之旅

本文详细介绍了如何利用RC低通滤波器将STM32F103生成的PWM信号转换为高质量正弦波的技术原理与实践方法。通过分析滤波器设计、参数计算、硬件实现及Proteus仿真验证,为嵌入式开发者提供了一套完整的PWM转正弦波解决方案,适用于电机控制、音频信号生成等多种应用场景。

jupi8的博客 391

设计的多实例引用(Multiple Instances of a Design Reference)

一、什么是“设计的多实例引用” 在层次化的设计中,我们经常会将一个module例化多份,这些例化的instance就是设计的module的多实例引用。 二、为什么要解决多实例引用 三、怎么解决多实例引用 ...

kevindas的博客 3722

Machined Surfaces UVA - 414

题目链接:Machined Surfaces UVA - 414 #include <bits/stdc++.h> using namespace std; int main() { int n,sum,cnt,mincnt; char c; while(~scanf("%d\n",&n)&&n!=0) { ...

Ai_Mijie的博客 220

「PAT乙级真题解析」Basic Level 1034 有理数四则运算 (问题分析+完整步骤+伪代码描述+提交通过代码)

题设给定两个有理数, 要求输出这两个有理数的和、差、积、商。 如果只是这样, 则问题很简单, 但是题设要求输出的每个有理数必须是最简形式. **所以本题的一个重点是如何将有理数转为题设要求的有理数.**

过美好生活,做高效程序员 3133

UVa OJ 414-Machined Surfaces

<br /> <br />简单题啊:<br />{ Author:wzx961008 Problem:UVa 414-Machined Surfaces Verdict:Accepted Language:PASCAL Run Time:0.012s Submission Date:2011-01-15 00:37:07 } var n,i,j,min,ans:longint; a:array[1..13,1..25]of char; num:array[1

Chiwin 771

001、NPU是什么?为什么嵌入式设备需要它?

本文通过作者调试工业相机板卡的经历,引出嵌入式设备为何需要NPU(神经网络处理器)的探讨。文章对比了CPU和NPU的设计哲学差异,指出NPU通过专用乘加器阵列和优化的数据流,能高效处理神经网络运算。作者分析了嵌入式设备使用NPU的三大优势:算力提升、功耗降低和实时性保障,并介绍了三类常见NPU形态。通过一个YOLOv5模型调试案例,揭示了NPU使用中的常见陷阱,最后给出五条实用建议,强调理解NPU原理和局限的重要性。文章生动展现了NPU在嵌入式AI应用中的关键作用。

m0_50546716的博客 130

024、反激变换器的短路保护设计

本文详细探讨了反激变换器短路保护的设计要点与实践经验。作者通过实际案例分析了短路时反激拓扑的电流特性,指出初级峰值电流限制是最基础的保护手段,但需配合打嗝模式使用。文章重点剖析了打嗝模式设计的三个关键陷阱:频率设定、退出条件和软启动衔接。同时强调次级侧辅助保护、变压器参数优化、环路响应协调的重要性,并比较了自恢复与锁死方案的适用场景。最后提出实测验证的四个关键点和设计经验:不盲信芯片手册、保护电路独立设计、充分留有余量、进行破坏性测试。全文以工程实践为导向,为反激电源的可靠短路保护提供了系统性解决方案。

Jack010169的博客 250

UVA414—— 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 i

丙三醇 5185

YOLO + Qwen3-VL-Seg 深度诊断:双引擎协同完成AI质检

本文提出了一种创新的工业质检双引擎架构,结合YOLO实时检测与Qwen3-VL-Seg精细化诊断,有效解决了传统检测方法中检测与诊断割裂的问题。YOLO部署在边缘端实现高效定位(3.2MB模型,<10ms延迟),Qwen3-VL-Seg在云端完成语义级缺陷分析(仅17M参数的解码器实现像素级分割)。该方案通过6步闭环流程,从实时感知到工艺反哺,显著提升了工业质检的准确性和可解释性,为智能制造提供了从"发现"到"解决"的完整技术路径。

mingo_敏 230

uva414 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 thi...

aiba1227的博客 2527

【数据集8】全球人口数据WorldPop详解

全球人口数据WorldPop详解

WW、forever的博客 7890

锂电池充电器电路设计 里面有电路

锂电池充电器电路设计 里面有电路 3.7V升压到5V电路设计。

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 i

老鼠 1203

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

UVA - 414 Machined Surfaces

Machined Surfaces Time Limit: 3000MS   Memory Limit: Unknown   64bit IO Format: %lld & %llu Submit Status Description An imaging device furnishes digital images of tw

acm_1361677193的专栏 563

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

UVa414 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 t

江枭的专栏 4007

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

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

UVA 414 Machined Surfaces

题目:把两边X组成的东西合起来,合到最先中间X与X相碰的情形,停止。看n行中间有几个空格。 分析:可以从空格出发,也可以从X出发。计数。 注意:仔细读题 #include<iostream> #include<cstdio> #include<cstring> using namespace std; int main() { int n; ch...

hgeeacker的博客 204

UVa 414 - Machined Surfaces

题目:n个由X和空格组成的串,两边有至少一个X,将n个串压缩,每次每行消除一个空格,问到不能消除时剩余的空格。 分析:简单题。统计全体空格数sum_b和最少空格数min_b,则结果就是sum_b - n*min_b。 注意:利用gets或者getline读入串。 #include #include #include #include using namespace std;

小白菜又菜 1649

UVA-414-Machined Surfaces

这道题目就是以水题,无非就是题意难以理解而已。 题目的大致意思是:首先输入一个数字N,代表接下来要输入几行字符串;     每行字符串的格式为:由字母X和空格 (“ ”)组成,且两边是字符X,中间是空格。每行的开始有一个或多个X,中间有0个或多个空格,末端有一个或多个X。     要求:将N行中的左边的字符X同时向右移动(或右边的字符X向左移动),直到有一行中间没有空格时停止所有行的移动,此

青竹梦 2555

UVA 414 Machined Surfaces

#include int main() { int n; while (scanf("%d", &n), n) { getchar(); int min = 100, sum = 0, num = n; while (n--) { int count = 0; char str[30]; gets(str); for (int i = 0; i < 25

Bingo 1815
上一篇: 搬家到csdn
下一篇: 校赛笔试记
滑头鬼之亨
博客等级 码龄15年 53粉丝 169原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值