Crossword Answers

光电式烟雾传感器实战指南(一) 光迷宫设计与散射原理篇 本文深入解析了光电式烟雾传感器的核心部件——光迷宫的设计原理与光散射机制。文章详细阐述了如何通过精心设计的光学结构实现‘透气不透光’,并重点探讨了前向散射(尤其是135°角)在提升烟雾监测系统灵敏度与可靠性中的关键作用,为DIY爱好者提供了从理论到实践的完整指南。 阅读详情

A crossword puzzle consists of a rectangular grid of black and white squares and two lists of definitions (or descriptions).

One list of definitions is for ``words" to be written left to right across white squares in the rows and the other list is for words to be written down white squares in the columns. (A word is a sequence of alphabetic characters.)

To solve a crossword puzzle, one writes the words corresponding to the definitions on the white squares of the grid.

The definitions correspond to the rectangular grid by means of sequential integers on ``eligible" white squares. White squares with black squares immediately to the left or above them are ``eligible." White squares with no squares either immediately to the left or above are also ``eligible." No other squares are numbered. All of the squares on the first row are numbered.

The numbering starts with 1 and continues consecutively across white squares of the first row, then across the eligible white squares of the second row, then across the eligible white squares of the third row and so on across all of the rest of the rows of the puzzle. The picture below illustrates a rectangular crossword puzzle grid with appropriate numbering.

An ``across" word for a definition is written on a sequence of white squares in a row starting on a numbered square that does not follow another white square in the same row.

The sequence of white squares for that word goes across the row of the numbered square, ending immediately before the next black square in the row or in the rightmost square of the row.

A ``down" word for a definition is written on a sequence of white squares in a column starting on a numbered square that does not follow another white square in the same column.

The sequence of white squares for that word goes down the column of the numbered square, ending immediately before the next black square in the column or in the bottom square of the column.

Every white square in a correctly solved puzzle contains a letter.

You must write a program that takes several solved crossword puzzles as input and outputs the lists of across and down words which constitute the solutions.

Input

Each puzzle solution in the input starts with a line containing two integers r and c ( tex2html_wrap_inline39 andtex2html_wrap_inline41 ), where r (the first number) is the number of rows in the puzzle and c (the second number) is the number of columns.

The r rows of input which follow each contain c characters (excluding the end-of-line) which describe the solution. Each of those c characters is an alphabetic character which is part of a word or the character ``*", which indicates a black square.

The end of input is indicated by a line consisting of the single number 0.

Output

Output for each puzzle consists of an identifier for the puzzle (puzzle #1:, puzzle #2:, etc.) and the list of across words followed by the list of down words. Words in each list must be output one-per-line in increasing order of the number of their corresponding definitions.

The heading for the list of across words is ``Across". The heading for the list of down words is ``Down".

In the case where the lists are empty (all squares in the grid are black), the Across and Down headings should still appear.

Separate output for successive input puzzles by a blank line.

Sample Input

2 2
AT
*O
6 7
AIM*DEN
*ME*ONE
UPON*TO
SO*ERIN
*SA*OR*
IES*DEA
0

Sample Output

puzzle #1:
Across
  1.AT
  3.O
Down
  1.A
  2.TO

puzzle #2:
Across
  1.AIM
  4.DEN
  7.ME
  8.ONE
  9.UPON
 11.TO
 12.SO
 13.ERIN
 15.SA
 17.OR
 18.IES
 19.DEA
Down
  1.A
  2.IMPOSE
  3.MEO
  4.DO
  5.ENTIRE
  6.NEON
  9.US
 10.NE
 14.ROD
 16.AS
 18.I
 20.A
纯洁的我一开始是不知道紫书上有翻译的,然后……,题目就是一个字谜,然后按横向纵向输出单词,看了看样例大概能yy出来。
然后就是模拟,题目里面也说了,首先,第一行都是有数字的,然后就是左面或者上面是黑色的格子也有数字,按照这个规律对格子赋值就好了,最后按行或列找标记的数字输出就好了。
#include<cstdio>
#include<cstring>
#include<iostream>
#include<string>
#include<queue>
#include<algorithm>
using namespace std;
string a[15];
int dp[15][15];
int main()
{
	int i, j, m, n, ans, r, c, cnt, leap, p, k;
	p = 1;
	while (scanf("%d", &r) != EOF)
	{
		if (r == 0)break;
		scanf("%d", &c);
		for (i = 0; i < r; i++)
			cin >> a[i];
		for (i = 0; i < r;i++)
		for (j = 0; j < c; j++)
		{
			dp[i][j] = 0;
		}
		cnt = 1; leap = 0;
		for (i = 0; i < c; i++)
		{
			if (a[0][i] == '*')
				leap = 0;
			else if (leap == 0){
				dp[0][i] = cnt++;
				leap = 1;
			}
			else if (leap == 1){
				dp[0][i] = cnt++;
				leap = 1;
			}
		}
		for (i = 1; i < r; i++)
		{
			for (j = 0; j < c; j++)
			{
				if (a[i][j] == '*')continue;
				else if (j >= 1 && a[i][j - 1] == '*')
				{
					dp[i][j] = cnt++;
				}
				else if (j == 0 && a[i][j] != '*')
					dp[i][j] = cnt++;
				else if (a[i - 1][j] == '*')
					dp[i][j] = cnt++;
			}
		}
		if (p != 1)
			cout << endl;
		cout << "puzzle #" << p << ":" << endl;
		p++;
		cout << "Across" << endl;
		for (i = 0; i < r; i++)
		{
			for (j = 0; j < c; )
			{
				if (dp[i][j])
				{
					if (dp[i][j] < 10)
						cout << "  " << dp[i][j] << ".";
					else
						cout << " " << dp[i][j] << ".";
					k = 0;
					while (j + k < c&&a[i][j + k] != '*')
					{
						cout << a[i][j + k];
						k++;
					}
					j = j + k;
					cout << endl;
				}
				else j++;
			}
		}
		cout << "Down" << endl;
		for (i = 0; i < c; i++)
		{
			if (dp[0][i])
			{
				if (dp[0][i] < 10)
					cout << "  " << dp[0][i] << ".";
				else
					cout << " " << dp[0][i] << ".";
				j = 0;
				while (j < r&&a[j][i] != '*')
				{
					cout << a[j][i];
					j++;
				}
				cout << endl;
			}
		}
		for (i = 1; i < r; i++)
		{
			for (j = 0; j < c; j++)
			{
				if (dp[i][j] && a[i - 1][j] == '*')
				{
					if (dp[i][j] < 10)
						cout << "  " << dp[i][j] << ".";
					else
						cout << " " << dp[i][j] << ".";
					k = 0;
					while (i + k < r&&a[i + k][j] != '*')
					{
						cout << a[i + k][j];
						k++;
					}
					cout << endl;
				}
			}
		}
	}
	return 0;
}


TSMaster二次开发实战:如何用Python搞定CAN/CANFD事件回调(附完整代码) 本文详细介绍了如何利用Python进行TSMaster二次开发,实现CAN/CANFD事件回调功能。通过实战代码演示,讲解了预发送与后处理回调的核心区别、注册流程、资源管理及性能优化技巧,帮助工程师高效构建自动化测试与数据监控应用。 阅读详情

相关推荐

从拆箱到跑通:Intel RealSense D435i开箱实测+ROS驱动配置全流程

本文详细记录了Intel RealSense D435i深度相机的开箱体验,并提供了在Ubuntu 22.04与ROS2 Humble环境下,从安装librealsense2 SDK到配置ROS2驱动的完整流程。重点解决了驱动安装、数据流发布、点云对齐以及IMU数据融合等关键步骤,帮助研究者和开发者快速实现D435i与机器人系统的集成。

weixin_29168393的博客 304

UVa 232 Crossword Answers

Crossword Answers  A crossword puzzle consists of a rectangular grid of black and white squares and two lists of definitions (or descriptions). One list of definitions is for ``words" to b

c21c21的专栏 408

MTK PE+2.0介绍

  PE+2.0介绍:   1.      PE+2.0的状态机: 2.      升压波形协议及编码规则: PE+2.0软件设计:   在充电器类型为标充且底层电量SOC在1%—95%之间时,开始PE+2.0升压充电器的检测:首先将VBUSreset至5V,之后发送8.5的current pattern再获取此时VBUS电压和8.5V比较,若其与8.5的差值绝对值在0.5之...

raydom07的博客 1万+

TOJ-1023 crossword

A crossword can be stored as a matrix m x n of zeros and ones. Zero represents white squares and one represents black squares. Some squares of the crossword are numbered and assigned to these ...

204

Abaqus传热分析HETVAL和USDFLD子程序联合

Hetval子程序常用于定义内部热源,该子程序可以定义材料内部的生热量(如相变、高分子结晶生热),并且能够调用state variable 状态变量,可以与USDFLD子程序联合使用。HETVAL子程序用于计算传热系数并在单元上定义,USDFLD子程序用于在每个时间布更新温度场。

qq_41900477的博客 2660

AF3​​​​​​​ Msa、TemplateHit、HitMetadata类解读

Msa:处理 多序列比对 (MSA) 结果,为 AlphaFold3 提供 序列进化信息。 TemplateHit:存储 查询序列与模板结构的比对信息,用于 筛选模板。 HitMetadata:提供 比对模板的 PDB 结构信息,帮助 解析和使用模板数据。

qq_27390023的博客 818

UVa232 Crossword Answers(纵横字谜的答案)

题意: 输入一个r行c列的网格,*表示黑格,字母表示白格。若一个白格位于边界或上方是黑格或左方是黑格,则称其为起始格。找出所有横向单词和竖向单词,其必须从一个起始格开始,到黑格或网格边界为止。 思路: 设置三个数组,一个用于存放输入的原始数据,一个用于存放关联的编号数据,一个用于判断该位置字母是否已输出过。 遍历两遍原始数据数组,第一遍寻找横向单词,第二遍寻找竖向单词。寻找横向单词时较为简单,当找到一个起始格时便由此向右依次输出,直到遇到黑格或边界,已...

weixin_44820919的博客 296

生信实战:用bcftools玩转VCF文件处理(从压缩到注释全流程)

本文详细介绍了使用bcftools处理VCF文件的全流程实战指南。从数据准备、压缩索引、信息提取、质量统计到核心的变异过滤与功能注释,手把手教你高效管理基因组变异数据。重点阐述了如何利用bcftools进行VCF文件注释,整合外部数据库信息,为变异位点添加关键的生物学标签,是生物信息学数据分析的必备技能。

rgv23456789的博客 340

UVA-232 Crossword Answers

题目在这 标签:字符串 题目大意:给你rxc的方格图形,里面有字母块、黑色块、空白块,通过一定的规则给方块编号:第一行和第一列除去黑色块全部编号,其余的,只要在黑色块的下方或右方均要编号,其余的不进行编号,编号顺序按照一行一行的来。 任务:先按照行(Across)来输出字母,字母串前面要有第一个字母的编号; 再按照列(Down)输出字母。具体格式参照原题。 这几天是题目难了,还是自己静不下心来,无...

weixin_45883286的博客 237

大疆sdkV4以及V5webrtc推流

webrtcSDK中要用它的VideoCapturer来初始化推流 ViewdoCapturer是一个接口我们继承它 然后重建创建文件CapturerAircraft.java文件。CameraUtil.java这个是我们用来创建CapturerAircraft的一个工具。除了CapturerAircraft这个文件不一样外其他都是一样的。PlayBodyBean.java这个是我们的配置文件。下面的有个代码块第一个是v4的 第二个是v5的。接着我们来创建几个推流用到的webrtc工具。

weixin_41624865的博客 1187

170、电机控制中的温升测试

本文以一次IGBT炸管事故为切入点,深入剖析电机控制中温升测试的实质:不仅是温度测量,更是对铜损、铁损、散热效率等热管理问题的系统验证。作者强调测试前热电偶布置、环境记录、预运行的重要性,提出实时监控电流谐波、绕组电阻、散热梯度等关键参数,并通过损耗分离与冷却系统实测,揭示真实热源。结合温升曲线异常分析与经验建议,强调留余量、仿真结合实测、关注瞬态工况等实践要点,警示温升测试是保障可靠性与安全性的核心环节。

2401_88858637的博客 47

史上最牛的Crossword

    这是一个由 Lee Sallows 创造的谜题。下面这个 Crossword 中有 6 个横向短语和 6 个纵向短语。每个短语都是形如“多少多少个某某字母”的形式,比方说 “THIRTEEN NS” 、 “EIGHT ES” 等等,它表示整个 Crossword 中恰好就有 13 个字母 N , 8 个字母 E 。由于整个 Crossword 中有 12 个短语,这就意味着

matrix67的专栏 1297

滑模控制算法(SMC)讲解-案例(附C代码)

该文章介绍了滑模控制算法的原理实现步骤,特点及关键问题,最后以车辆控制案例来讲解滑模控制的整个步骤实现

heda3的博客 4111

UVa232.Crossword Answers

题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=168 (该题目同POJ 1888) 13832879 232 Crossword Answers Accepted C++ 0.27...

banxuanliu0005的博客 144

Outlook Express 6 (OE6) for Win7/Win8/Win10

英文版 Outlook Express6.0, 兼容Win7/Win10/WinXP,解压就可用。

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

UVA 232-Crossword Answers

UVA 232-Crossword Answers题目大意: 给个二维数组表,*为分割,分别横向和纵向输出解题思路:遍历编号,非首字母编为0#include <stdio.h> #include <iostream> #include <string.h> using namespace std; int main() { int m, n; int t = 0; char

ZeroLH00的博客 420

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

习题3-6 UVA232 Crossword Answers(49行AC代码)

紫书刷题进行中,题解系列点这里 习题3-6 UVA232 Crossword Answers(49行AC代码) 思路分析 给定N*M的网格,有黑白两种格子,从上到下,从左到右依次对左侧和上侧没有白格子的白格子进行标号,具体如下: 第一行和第一列的白格子均编号 其余行列,若一个白格子的左侧或上侧存在黑格子,则对其进行编号 编号完成后,分别按行和按列输出相应子串,子串以有编号的白格子开始,遇见黑格...

努力做个书呆儿 343

VC中sqlite的使用

在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示

I - Crossword Answers

题目描述 输入一个r行c列(1&lt;=r,c&lt;=10)的网格,黑格用"*"表示,每个白格都填有一个字母,如果一个白格的左边相邻的位置或者边上相邻的位置没有白格(可能是黑格,也可能除了网格边界), 则称这个白格是一个起始格。首先把所有起始格按照从上到下,从左到右的顺序编号为1,2,3…,如图。接下来要输出所由横向单词,这些单词必须从一个起始格开始,向右延伸到一个黑格的左边,或者整个网格的最右...

逐梦er的博客 2156

UVA232 纵横字谜的答案 Crossword Answers

读取网格字符存入二维字符数组,同时开辟编号二维数组用来保存每个格子对应的序号,之后逐行逐列遍历网格,依据规则判断格子是否具备编号资格,满足条件就依次分配连续数字并记录到编号数组里,完成编号工作,随后再遍历网格提取横向单词,找到每行中横向单词的起始位置,从起点向右持续收集字母直到碰到黑格或者边界,将起点编号和拼接得到的单词存入 TreeMap,再用类似逻辑遍历提取纵向单词,向下收集字母并存入另一个 TreeMap,最后遍历依次遍历两个TreeMap进行输出。格式错误:编号固定占三格!

2401_85048117的博客 209

Uva232 Crossword Answers

/* 1.因为输入的两个整数决定了这一次循环要接收的字符数, 所以可以通过判断第一个数字是否为0来结束输入。 2. 判断是否标记数字。whitesquare的左边或上边若没有whitesquare,则可以标上 3.打印时如何判断一个标号是已经打印还是应该要从他打印起? 设置记号法不可取,因为across输出会影响down输入。 Across: 对于某一行,从第一个开始输出,直到遇到边界或者遇到黑格 Down: 如果这个whitesquare的上面不是whitesquare即可要以它为起始

qq_36010523的博客 900

POJ 1888 Crossword Answers G++ 模拟

#include <iostream> #include <cstdio> #include <vector> #include <string> #include <cstring> using namespace std; //英语 看博友程序 抄博友程序 模拟 char a1[20][20]; char a2[20][20]; int da[20][20]; struct nod{ str...

woniupengpeng的专栏 349

[UVA232]Crossword Answers

吸取了上一次的经验,这道题一共提交了两次得到AC(好开心,第一次这么少的次数就A了)。 注意事项: 1.输入上,这次非常的严格。输出上还是严格的按照要求来, 比如最后没有另外的空行啊, 序号的输出可以用%3d来输出(没尝试过其他的,scanf(“%3dxxxx”)通过了)。技巧: 1.在CROSSWORD的后面一列和最下面一列用’*’填充,来简化输出的复杂度。 2.虽然题目要求排序,但是不一

Ericarrow的博客 597

232 - Crossword Answers

水题,注意各组数据之间一个空行,前后没有空行 #include #include char s[20][20]; int b[20][20]; int a[20][20]; int main() {     int r,c,i,j,k,n,maxn=1,ens=0;     while(scanf("%d",&r)!=EOF&&r)     {         sca

AC_Arthur的专栏 751

Uva 232 Crossword Answers

#include&amp;amp;amp;amp;lt;stdio.h&amp;amp;amp;amp;gt; #include&amp;amp;amp;amp;lt;stdlib.h&amp;amp;amp;amp;gt; #include&amp;amp;amp;amp;lt;ctype.h&amp;amp;amp;amp;gt; #include&amp;amp;amp;amp;lt;string.h&amp;amp;amp;amp

流浪_石头 198

Crossword Answers UVA - 232

A crossword puzzle consists of a rectangular grid of black and white squares and two lists of definitions (or descriptions). One list of definitions is for “words” to be written left to right across white squares in the rows and the other list is for words

就很好(*^_^*)的博客 202

纵横字谜的答案 Crossword Answers

每个白格都填有一个字母。如果一个白格的左边相邻位置或者上边相邻位置没有白格(可能是黑格,也可能出了网格边界),则称这个白格是一个起始格。这些单词必须从一个起始格(左边是黑格,或是第一列)开始,向右延伸到一个黑格的左边或者整个网格的最右列。然后找出所有竖向单词(),规则同上,这些单词必须从一个起始格(上边是黑格,或是第一行)开始,向下延伸到一个黑格的上边或者整个网格的最下行。有一个 r 行 c 列 (1

大学在读,感谢关注 935
上一篇: Puzzle
下一篇: DNA Consensus String
Techay
博客等级 码龄11年 11粉丝 174原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值