UVa 489 Hangman Judge

第110章 PCL PointCloudFusing 点云融合重建详细讲解 点云融合是指将多个不同视角、不同位置、不同传感器获取的点云数据进行合并,得到一个更加完整、准确的三维模型。多视角扫描:从多个相机或传感器获取点云数据,需要将这些数据融合成一个统一的三维模型。传感器融合:例如将激光雷达(LiDAR)点云与相机的图像数据融合,以便获得更高质量的三维重建。动态场景重建:动态环境中的物体,点云数据不断更新,如何平滑地融合这些点云是一个重要课题。点云融合的目标是将不同来源的点云数据准确地合并,消除冗余,减少噪声,并提高整体的点云密度和精度。 阅读详情

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 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
| /|\
| |
| / \
__|_
| |______
|_________|
  1. If the drawing of the hangman is completed before the contestant has successfully guessed all the
    characters of the word, the contestant loses.
  2. If the contestant has guessed all the characters of the word before the drawing is complete, the
    contestant wins the game.
  3. 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.


题目中文名:刽子手游戏
翻译自己解决

书上的看起来就复杂

这段代码我用udebug调试5次以上
一开始还担心超时,不过还好没有

主要是几个问题
1.对字母重复出现的处理,因为是单词里有那个字母,所有该字母都会显示出来,所以要对标准单词所有字母进行遍历循环
2.对测试字母数大于标准字母数量,但提前通过测试
如

t
stywerewroiewru,虽然错误字母超过7个,但是在前7个字母里面有t,所以仍然算是win

#include <cstdio>
#include <cstring>

int main()
{
    int n;
    while(scanf("%d",&n))
    {
        if(n==-1)
            break;
        char s[100],st[100];
        scanf("%s%s",st,s);
        int cnt=0;
        int bog=0;
        int j,k,i;
        for(i=0; i<strlen(s); i++)
        {
            int flag=0;//flag是表示是否这个字母在标准单词里能找到
            for(j=0; j<strlen(st); j++)
            {
                if(s[i]==st[j])//对标准单词所有字母进行遍历循环,不能检测到正确的就跳出循环
                {
                    st[j]=' ';//检测过的,变为‘ ’
                    cnt++;
                    flag=1;
                }
            }
            for(k=0; k<i; k++)//检测这个字母是否重复出现,重复出现的字母也算是错误的
                if(s[i]==s[k])
                    flag=1;
            if(flag==0)//如果之前没有出现过,并且标准单词里面没有,则要给错误次数加上1
                bog++;//bog是错误的次数
            if(cnt==strlen(st))//这里就是对如果满足条件,提前跳出循环输出结果
                break;
        }
        printf("Round %d\n",n);
        if(cnt==strlen(st)&&bog<=6)
            printf("You win.\n");
        else if(bog>6)
            printf("You lose.\n");
        else if(bog<=6)
            printf("You chickened out.\n");
    }
    return 0;
}
Ubuntu零基础入门到精通【1.1讲】:什么是 Ubuntu?一文带你彻底搞懂! 🏆 本文收录于 《滚雪球学 Ubuntu》 专栏。 本专栏面向有一定计算机基础,但尚未系统学习 Linux / Ubuntu 的读者,采用“滚雪球式学习法”:先装好、再会用、再理解、再优化、再实战,带你从第一次进入 Ubuntu 桌面 / 终端开始,逐步掌握 Ubuntu 的日常使用、命令操作、软件安装、系统配置、开发环境搭建与服务器部署能力。 阅读详情

相关推荐

ORCAD原理图关联封装时出现ERROR(ORCIS-6245)、ERROR(ORCIS-6013)问题

1、当你进行如下操作时: 系统先是提示你出现ERROR(ORCIS-6245)然后再确定后再出现ERROR(ORCIS-6013)问题 是由于你的数据库的路径不对。 具体操作方法如下:1、先找到你的CAPTURE.INI文件。 2、用记事本打开CAPTURE.INI。找到下图路径 3、在你的Orcad capture CIS原理图软件中点击 Options------>CIS con...

weixin_42304393的博客 2万+

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

weixin_34162228的博客 347

Win10内网离线安装NET3.5,绝对成功,保姆级

今天工作安装工具软件套装3.5组件!也在csdn上找了很多方法躺了很多坑,我总结如下! 其实就一条,什么版本的win10装什么版本的net3.5 我的电脑是1909版本,用2004H2的镜像是没有用的,dism组件报错8024402C 所以我下载1909镜像挂在虚拟光驱 ,管理员模式下powershell dism.exe /online /enable-feature /featurename:NetFX3 /Source:E:\sources\sxs dism.exe /online /en..

唉呀妈呀脑瓜疼 6万+

UVA - 489 - Hangman Judge

题目传送门/* 题目大意:给出两个字符串 如果第二个字符串中出现了和第一个字符串相同的字符,比如字符e,则第一个字符串的那个字符e全部消失 也就是第二个字符串的那个字符e再次出现时,第一个字符串表示没有这个字符e了 如果第二个字符串出现了一个字符,在第一个字符串找不到相同的字符,则表示出错,出错的次数最多为7次 错误次数超过7输出You lose;第一个字符串的字符全部消失输出You w...

qq_15556277的博客 180

【自动驾驶规划】Lattice Planner

Lattice Planner简介 LatticePlanner算法属于一种局部轨迹规划器,输出轨迹将直接输入到控制器,由控制器完成对局部轨迹的跟踪控制。因此,Lattice Planner输出的轨迹是一条光滑无碰撞满足车辆运动学约束和速度约束的平稳安全的局部轨迹。Lattice Planner的输入端主要由三部分组成,感知及障碍物信息、参考线信息及定位信息。局部规划模块的输出是带有速度信息的一系列轨迹点组成的轨迹,其保证了车辆控制器在车辆跟踪控制过程中的平稳性和安全性。 局部规划模块的输出是带有速

uytguytgf的博客 6491

告别抓包失败!保姆级配置:让Burp+Proxifier稳定抓取任意微信小程序

本文提供了一套完整的Burp+Proxifier配置方案,确保稳定抓取微信小程序数据。从环境准备、工具选型到Burp Suite深度配置和Proxifier精准设置,详细解决了证书安装、进程捕获和乱码解析等核心问题,帮助开发者告别抓包失败,提升调试效率。

weixin_28738165的博客 454

UVA - 489 Hangman Judge

#include &lt;bits/stdc++.h&gt; using namespace std; string s,s1; int W,Le; int f,cas; void guess(char c) { int t=1; for(int i=0; i&lt;s.length(); i++) { if(s[i]==c) { ...

葉蕖的博客 575

Matlab使用GitHub的踩坑记录(持续更新)

Matlab使用git的踩坑记录前言Matlab设置Git的官方帮助文档系统配置新建Git两种代码管理方式典型源代码管理SVN分布式源代码管理 Git注意:SVN和Git都可以用GitHub创建新的库 前言 作为Git初学者,对Git的代码版本管理非常非常喜欢,给了我极大的安全感。特别是想到之前的几次Matlab、Latex和python的代码莫名其妙被折腾没了又没法找回的悲剧,决定慢慢的走入gi...

voluntry的博客 7296

UVa 489

题意:猜测单词,输入三行第一行是输入时第几次,第二行是要猜的单词,第三行是猜测的单词。 注意:重复猜测认为错误。 #include #include #define Maxn 100 int left ,chance; //left 是需要判断总字母数,chance 是有7次错误的机会 int win ,lose; char s1[Maxn],s2[Maxn]; void guess(cha

Since_natural_ran 493

别再手动备份了!用Python脚本批量导出华为/华三交换机配置(附完整代码)

本文详细介绍了如何使用Python脚本实现华为/华三交换机配置的自动化备份,大幅提升网络运维效率。通过paramiko库建立SSH连接,结合pandas处理设备清单,实现配置的批量导出与规范化存储,解决传统手动备份耗时易错的问题。

weixin_28737603的博客 448

微信小程序 - 实现大文件上传分片/切片+本地选择文件上传超大文件,小程序大文件切片上传+断点续传+上传进度条+失败自动重传完整运行示例源码,支持图片、视频、文档各种文件(支持上传单个文件或批量上传)

微信小程序实现大文件上传,实现分片大文件上传,微信小程序 分片 断点续传 大文件上传,微信小程序实现大文件上传 分片上传 进度条,小程序文件分片上传,微信小程序如何上传很大的文件,在选择文件后,按指定大小将文件切割成独立的文件片,并逐片上传,uniapp 微信小程序上传大文件如何切片,微信小程序实现大文件分片上传、断点续传、秒传,解决大文件上传问题,大文件上传如何做断点续传,微信小程序wx.uploadFile,小程序上传视频,小程序上传文档,实现大文件上传(切片上传)实现大文件上传到服务器教程,支持批量多

🏆 前端领域优质创作者 1万+

UVA489 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 the classic game ...

海岛Blog 2029

Android性能分析——hprof文件分析(一)

hprof  文件是 Java 堆转储文件(Heap Dump File)的标准格式,用于保存 Java 虚拟机(JVM)在某个时间点的内存快照。这种文件对于分析内存泄漏、内存使用情况和对象分配模式非常有用。

小旭的专栏 1877

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

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

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

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

【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

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

【基础练习】【模拟】Uva489 - Hangman Judge题解

ruka(刘汝佳《算法竞赛入门经典》第二版)第四章的例题,原题目使用函数写的,我读了代码后自己写了一遍,没有用函数,调了十几分钟,写这篇题解总结一下教训。 题目大意是判断输入的字符串是否猜中 猜中一个字母就猜中了所有相同字母 重复猜一个字母算错 一共有七次猜错机会 如果机会内猜对就赢了(win) 用光机会就输了(lose) 没用光但也没猜对就是放弃了 (chickend out) 代码放上:

西家家 1092

uva 489 Hangman Judge

489 - Hangman Judge

AC__GO的博客 415

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

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

来日浅谈的博客 561

UVA489Hangman 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 the classic game of hangman, and are given as follows: The contestant trie

qq_34596217的博客 239

[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 same as the classic game ...

weixin_37992828的博客 208

Uva489_Hangman Judge心得感悟

其实碰到看题目有就一点思路的题,我就知道题目其实不是很难,也不会转很多弯子,所以信心满满的写了个个大概思路去做了就。 第一阶段,写出的代码能差不多符合例样的数值,本想着对着udebug的数值就可以,结果一对发现太多答案不对了,这下我懵逼了。 ** **问题:**利用split函数时,"."作为特殊字符,需要利用//来转义,学到了学到了。 ** 第二阶段,试着看了一下输入输出格式(其实第一阶段的时候...

qq_43736081的博客 286

UVA489 刽子手的游戏 Hangman Judge

题目描述 PDF 输入格式 输出格式 题意翻译 刽子手游戏是一款猜单词游戏,计算机想一个单词让你猜,你每次可以猜一字母 如果单词里有那个字母,所有该字母会显示出来。(例如“book”,如果猜字母“o”,则两个o都会显示出来) 如果没有那个字母,则计算机会在一幅“刽子手”画上填一 笔。这幅画一共需要7 笔就能完成,因此你最多只能错6 次。 注意,猜一个已经猜过的字母也算错。在本题中,模拟这个过...

YUEXILIULI的博客 1948
上一篇: POJ 3176 Cow Bowling
下一篇: HDU 5702 Solving Order
Coder_Jeremy Wu
博客等级 码龄10年 12粉丝 53原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值