【例题4-2 uva489】Hangman Judge】的更多相关文章

题意:就是给出一个字符串,让你去一个一个猜测,相同字母算一次,如果是之前猜过的也算错,如果你在错7次前猜对就算你赢,文章中是LRJ的例题代码. #include<stdio.h> #include<string.h> #define maxn 100 int left, chance; char s[maxn], s2[maxn]; int win, lose; void guess(char ch) { int bad = 1; for(int i = 0; i < str…
题目链接:https://vjudge.net/problem/UVA-489 题意:给出两行字符串,第一行是标准答案,第二行是玩家猜的串.玩家每次猜一个,猜对一个,标准答案中所有该字符都算被猜到.猜错的次数不能到达七次.多次因同一个字符猜错算猜错一次(这个条件没有用). 猜对, 没猜对且错了七次, 没猜对但还没错到七次 分别输出 You win. You lose. You chickened out. 题解:模拟,莫名奇妙wa了一个小时.各种修改. 以至于找到了一组数据,oj检测不出来,手算…
 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 follo…
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 contesta…
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 水题. 中间就赢了算赢.(重复说,算错 [代码] #include <bits/stdc++.h> using namespace std; int _round; string s1,s2; int cnt[300]; int ok(string s){ int cur = 0; for (int i = 0;i < (int)s.size();i++){ int temp = s[i]-'a'; if (cnt[te…
#include<stdio.h> #include<string.h> int ok ,no; int left ,chance; char s[20] ,s2[20]; void guess(char ch) { int i ,bad = 1; for(i = 0;i < strlen(s);i++) { if(ch == s[i]) { left--; bad = 0; s[i] = ' '; } } if(bad) chance--; if(!left) { ok =…
大意:电脑想个单词,玩家来猜.玩家输入一个个字母,若答案里有这个字母,则显示该单词中所有该字母.最终目标是显示答案所有字母.猜错7次,死: 注意特殊条件:1.玩家不断重复错误的字母,只算一次猜错.2.如果答案是ans,读入了ansjklzxcv,这种情况算win的.虽然后面错误了7次,但游戏已经在猜出ans时提前结束了... #include<iostream> #include<cstdio> #include<cstring> #include<cstdlib…
题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=430 #include <iostream> #include <cstdio> #include <cstring> #include <cstdlib> using namespace std; ; int l, chance;…
题意:给一个字符串A,只含小写字符数个.再给一个字符串B,含小写字符数个.规则如下: 1.字符串B从左至右逐个字符遍历,对于每个字符,如果该字符在A中存在,将A中所有该字符删掉,若不存在,则错误次数+1. 2.当错误次数达到7时,游戏结束,输了lose. 3.当串A中已经没有字符了,游戏结束,赢了win.(串B后面还没遍历到的也不用遍历了) 4.当错误次数没到达7,但是字符串A还有剩下的字符没消去,则chickened out. 错满7个就输,在满7个之前匹配完了就赢,在满7个之前没匹配完就ch…
题目:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=430题意:两个字符串,第二个不能错七次,不能重复 思路:今天是帮学弟看题的,没帮学弟看出错误来...真惭愧... 于是自己写了一个.. #include <iostream> #include <cstring> using namespace std; int…