Hangman Judge

基于SpringBoot 3 + Vue 3的全栈民宿预约管理系统设计与实现 文章将详细阐述系统的需求分析、架构设计、数据库设计、核心功能模块的实现(包括用户认证、房源管理、订单流程、支付集成等),并提供关键代码片段,最后对系统进行总结与展望。.requestMatchers("/api/admin/**").hasRole("ADMIN") // 管理员接口。.requestMatchers("/api/auth/**").permitAll() // 认证接口公开。.requestMatchers("/api/public/**").permitAll() // 公开资源。 阅读详情

In ``Hangman Judge,'' you are to write a program that judges a series of Hangman games. For each game, the answer to the puzzle is given as well as the guesses. Rules are the same as the classic game of hangman, and are given as follows:

  1. The contestant tries to solve to puzzle by guessing one letter at a time.
  2. Every time a guess is correct, all the characters in the word that match the guess will be ``turned over.'' For example, if your guess is ``o'' and the word is ``book'', then both ``o''s in the solution will be counted as ``solved.''
  3. Every time a wrong guess is made, a stroke will be added to the drawing of a hangman, which needs 7 strokes to complete. Each unique wrong guess only counts against the contestant once.

       ______   
       |  |     
       |  O     
       | /|\    
       |  |     
       | / \    
     __|_       
     |   |______
     |_________|
  4. If the drawing of the hangman is completed before the contestant has successfully guessed all the characters of the word, the contestant loses.
  5. If the contestant has guessed all the characters of the word before the drawing is complete, the contestant wins the game.
  6. If the contestant does not guess enough letters to either win or lose, the contestant chickens out.

Your task as the ``Hangman Judge'' is to determine, for each game, whether the contestant wins, loses, or fails to finish a game.

Input

Your program will be given a series of inputs regarding the status of a game. All input will be in lower case. The first line of each section will contain a number to indicate which round of the game is being played; the next line will be the solution to the puzzle; the last line is a sequence of the guesses made by the contestant. A round number of -1 would indicate the end of all games (and input).

Output

The output of your program is to indicate which round of the game the contestant is currently playing as well as the result of the game. There are three possible results:

You win.
You lose.
You chickened out.

Sample Input

1
cheese
chese
2
cheese
abcdefg
3
cheese
abcdefgij
-1

Sample Output

Round 1
You win.
Round 2
You chickened out.
Round 3
You lose.
这个题目一定要看中文,卧槽,英语坑死我了,猜到一个字母,单词里这个字母全算猜对,但是再猜就算错,然后每个字母猜错只算一次,你猜错7次就会gg,小于7次但是没猜出来就是逃跑,猜对了就是猜对了,猜错的不会重复计算。直接列一个标记数组,原串出现的标记1,然后不同字母的个数,接着判断猜的串,猜对了把标记值改变,猜错了就标记,如果标记过了,就不减命,最后判断猜对的个数和原来个数是否相等,命是否还有,字符串是否还有,判断结果。
#include<cstdio>
#include<queue>
#include<cstring>
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
string a, b, c;
int leap[30];
int main()
{
	int i, j, m, n, ans, t, len1, len2, temp, k;
	while (scanf("%d", &t) != EOF)
	{
		if (t == -1)break;
		cin >> a >> b;
		c = "";
		len1 = a.size();
		len2 = b.size();
		memset(leap, 0, sizeof(leap));
		temp = 0;
		for (i = 0; i < len1; i++)
		{
			if (!leap[a[i] - 'a'])
			{
				leap[a[i] - 'a'] = 1;
				temp++;
			}
		}
		ans = 0;
		i = j = 0;
		for (i = 0; i < len2; i++)
		{
			if (leap[b[i] - 'a'] == 1)
			{
				temp--;
				leap[b[i] - 'a'] = -1;
			}
			else if (leap[b[i] - 'a'] == 0)
			{
				leap[b[i] - 'a'] = -1;
				ans++;
			}
			if (ans == 7)break;
			if (temp == 0)break;
		}
		cout << "Round " << t << endl;
		if (ans >= 7)
			cout << "You lose." << endl;
		else if (temp==0)
			cout << "You win." << endl;
		else
			cout << "You chickened out." << endl;
	}
	return 0;
}


069、PCIE属性字段:缓存、顺序与安全 上个月调试一块自研的PCIE采集卡,遇到了一个诡异的问题:主机通过DMA从设备读取图像数据,大部分帧正常,但偶尔会出现局部数据错位,像是缓存没刷干净。用逻辑分析仪抓链路层报文,发现TLP(事务层包)本身完好,但内存中的数据就是不对。排查三天后,终于锁定在设备端TLP的**属性字段(Attribute Field)**配置上——那几位看似不起眼的缓存、顺序控制位,差点让项目延期。今天我们就拆解PCIE事务头中的这个关键区域,看看它如何影响系统性能与数据安全。 阅读详情

相关推荐

Win11右键菜单显示更多选项设置默认展开方法

在Windows 11操作系统中,用户可能会发现右键点击桌面空白处时,弹出的菜单中仅显示“显示更多选项”,而并非直接展示所有可用的选项。这对于希望快速访问特定功能的用户来说,无疑增加了一些不便。为了优化这一体验,本文将介绍两种简单的方法,帮助用户设置Win11右键菜单,使其默认展开包含的所有选项。通过上述两种方法,用户可以轻松地将Win11右键菜单设置为默认展开所有选项,从而提高工作效率和便捷性。希望这篇文章对你有所帮助!

nntxthml的博客 1万+

4_2 刽子手游戏(UVa489)<自顶向下逐步求精法>

Hangman Judge是一个猜英文单字的小游戏(在电子字典中常会看到),游戏规则如下:1、答案单字写在纸上(每个字元一张纸),并且被盖起来,玩家每次猜一个英文字元(letter)。2、如果这个英文字元猜中(在答案的英文单字中有出现),被猜中的字元就被翻开。例如:答案是book,如果你猜o,book中的两个o就会被视为已猜中。3、如果这个英文字元未出现在答案的单字中,就会在hangman的图中多...

weixin_30291791的博客 382

【SigmaStar SSC335系列】空片用Flash_Tool烧写

简介 本文主要讲新拿到的PCBA,板上spi nand flash还是空的,如何在这种情况下烧录固件,这里讲解用官方Flash_Tool烧写的方式。 但只讲一些注意的地方和坑,其它的官方文档里说的比较清楚,不多说。 准备 Flash_Tool烧写软件 编译打包好烧写镜像 串口烧录小板 ----- 这个是个坑,在官方文档里并没有提及,刚开始用的平时调试的USB转串口,怎么都没反应,一度不知烧写软件不对还是硬件有问题,最后通过厂家技术支持才得知,除了专门的Flash_Tool外,还要专门的串口烧录器

老K 4696

【UVA 489 --- Hangman Judge】

【UVA 489 --- Hangman Judge】 题目来源:点击进入【UVA 489 — Hangman Judge】 Description In ``Hangman Judge,’’ you are to write a program that judges a series of Hangman games. For each game, the answer to the puzz...

来日浅谈的博客 560

[漏洞剖析]JeecgBoot queryFieldBySql注入与JDBC连接滥用:从内存马植入到RCE的完整攻击链

本文深度剖析了JeecgBoot框架中queryFieldBySql接口的SQL注入漏洞及其引发的完整攻击链。攻击者利用该漏洞,通过Freemarker SSTI植入隐蔽的内存马,并进一步滥用JDBC连接测试功能,借助H2数据库特性实现远程命令执行(RCE),揭示了低代码平台中功能滥用与安全配置疏忽带来的严重风险。

weixin_29232121的博客 115

Smart200 PLC实现Bool信号接通延时、关闭延时作用

解决Smart200 PLC时间继电器和脉冲扫描P或N不能重复使用的问题,用于Bool信号延时接通和延时关闭的作用,可调整时间基数

gk_121的博客 4317

UVa-489 Hangman Judge

题目要求猜字母,如果猜中某一个字母,则全部该字母都算猜中,如果猜错超过7次,则失败,未到错7次但未全部猜中则chickened out.题目中只会给出小写的样例,所以只需要考虑小写字母的情况.

没有标题哈哈哈 219

《谷歌数据分析方法》脑图笔记

目录壹、脑图笔记贰、《谷歌数据分析方法》脑图文稿[^1]一、 反思数据分析二、选择数据分析工具的最佳策略第一步:选择数据分析工具前要回答的3个关键问题第二步:选择数据分析工具前要问供应商的10个问题第三步:如何有效地试用数据分析工具第四步:确定合作前的协议,检查供应商的服务条款三、点击流分析的精彩世界:指标8个关键网站指标数据分析指标揭秘关键网站指标的战略性策略四、成功的关键:衡量绩效关注“少数关键指标”衡量非电子商务网站的成功衡量B2B网站五、调研和测试永不过时的3个最佳调研问题选择线上调研供应商的8个建

积跬步,慕至千里的博客 2925

刽子手游戏(Hangman Judge)

游戏规则是这样的:计算机想一个单词让你猜,你每次可以猜一个字母。 如果单词里有那个字母,所有该字母会显示出来;如果没有那个字母,则计算机会在一幅“刽子手”画上填一笔。 这幅画一共需要7笔就能完成,因此你最多只能错6次。 注意,猜一个已经猜过的字母也算错。 在本题中,你的任务是编写一个“裁判”程序,输入单词和玩家的猜测,判断玩家赢了(You win.)、 输了(You lose.)还是放弃了(You chickened out.)。 每组数据包含3行,第1行是游戏编号(-1为输入结束标记),第2行是计算机想的

韶言大雅 1280

工业级AI智能体落地:OpenClaw+ONNX Runtime全栈部署,端到端延迟压至12ms

OpenClaw+ONNX的组合为工业AI智能体的落地提供了一套完整、高效、安全的解决方案。它解决了传统云端智能体在工业场景中面临的延迟、安全和稳定性问题,实现了本地数据闭环和毫秒级响应。未来,随着边缘计算和轻量级大模型技术的发展,工业AI智能体将变得更加智能和强大。我们可以预见,在不久的将来,工厂里的每一台设备都将拥有自己的AI智能体,它们能够自主感知、自主决策、自主执行,真正实现工业生产的全自动化和智能化。👉 点击我的头像进入主页,关注专栏第一时间收到更新提醒,有问题评论区交流,看到都会回。

2601_94871597的博客 735

Jetson 平台编译安装 FFmpeg 7.1(支持 Nvmpi + SRT + x265)

摘要: 本文详细介绍了在NVIDIA Jetson平台上编译FFmpeg 7.1并集成关键功能的全过程。通过补丁方式加入Nvmpi实现硬件加速支持,同时编译集成x265编码器和SRT低延迟传输协议。步骤涵盖:1)安装x265编码器;2)配置SRT协议支持;3)编译jetson-ffmpeg的Nvmpi接口;4)定制化编译FFmpeg 7.1;5)验证模块集成情况。最终实现支持硬件编解码、高效HEVC压缩和可靠推流的增强版FFmpeg,为Jetson平台的音视频处理提供完整解决方案。

J。 345

刷题第十九题:Hangman Judge

题目链接:https://vjudge.net/problem/UVA-489#author=DaNao 题解:需要注意如果猜对了的前提下,无论才多少次错的,都win 算法是统计正确的字符串字符是否出现,并统计出现的个数,然后循环猜测的的字符串,如果正确,变为false,如果正确的个数等于出现的个数,那么就win,如果错误次数超过6次,则lose,其余情况为平局 代码: #include<iostream> #include<cstring> #include<algorith

qq_45712954的博客 221

【QGIS】软件下载安装及GIS4WRF插件使用

【QGIS】软件下载安装及GIS4WRF插件使用

WW、forever的博客 1799

【UVA】 489 --- Hangman Judge

【UVA】 489 --- Hangman Judge In “Hangman Judge,” you are to write a program that judges a series of Hangman games. For each game, the answer to the puzzle is given as well as the guesses. Rules are the...

来日浅谈的博客 485

WINCC7.3破解文件

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

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

UVA 489 - Hangman Judge

Hangman Judge In ``Hangman Judge,'' you are to write a program that judges a series of Hangman games. For each game, the answer to the puzzle is given as well as the guesses. Rules are the same as

LYHVOYAGE的专栏 3496

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

UVa 489 Hangman Judge(字符串)

一个字符串的游戏 有一个你不知道的字符串 你开始有7条命 然后你每次猜一个字母 若你猜的字母在原字符串中 原字符串就去掉所有那个字母 否则你失去一条命 如果你在命耗完之前原字符串中所有的字母都被猜出 则你赢 如果你在命耗完了原字符串中还有字母没被猜出 则你输 如果你在命没耗完原字符串中也还有字母没被猜出 视为你放弃 给你另一个字符串作为你猜的顺序 判断你是否能赢:

Good morning,good afternoon and good night 1195

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

Hangman Judge UVA - 489

题目链接:Hangman Judge UVA - 489 简单题。。。 #include #include #include #include #include #include #include #include #include #include #define ll long long using namespace std; int main(){ int t,vis[2

howell 195

UVaOJ 489 - Hangman Judge

#include #include #include int main() { int round = -1; int len = 0; int chs[26]; char buf[50]; memset(chs, 0, sizeof(chs)); memset(buf, '\0', sizeof(buf)); while (scanf("%d", &round) == 1

Ice He's Note 520

UVA - 489 ​​​​​​​Hangman Judge

Hangman Judge  UVA - 489  题目传送门 PS.此题Udebug有毒,即使100组样例全过,但还是WA,心塞。 这是我自己的代码,悲催的WA了 #include &lt;cstdio&gt; #include &lt;iostream&gt; #include &lt;algorithm&gt; #include &lt;cmath&gt; #include &l...

C++的星空 204

uva489 Hangman Judge

Hangman Judge  In ``Hangman Judge,'' you are to write a program that judges a series of Hangman games. For each game, the answer to the puzzle is given as well as the guesses. Rules are the

SeeBro专栏 3020

489 - Hangman Judge

Hangman Judge  In ``Hangman Judge,'' you are to write a program that judges a series of Hangman games. Foreach game, the answer to the puzzle is given as well as the guesses. Rules are the

XiaoCao's blog 768

uva 489 Hangman Judge

Hangman Judge Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld &amp; %llu Submit Status Practice UVA 489 Appoint description:  DaNao  (2011-04-19) System Crawler  (2016-03-19...

weixin_34177064的博客 91
上一篇: Ancient Cipher
下一篇: The Dole Queue
Techay
博客等级 码龄11年 11粉丝 174原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值