UVa 340 Master-Mind Hints (优化查找&复制数组)

CA51F3系列(国产)+低功耗模式 CA51F351P6芯片是基于1T 8051内核的8位微控制器,通常情况下,运行速度比传统的8051芯片快10倍,性能更加优越。内置8K Flash程序存储器,可多次重复编程的特性给用户开发带来了极大的方便。不仅保留了传统8051芯片的基本特性,还集成了12Bit ADC、LCD/LED驱动、Touch Key、16Bit PWM、 UART、RTC、低电压检测(LVD)等功能模块。支持IDLE、STOP和低速运行三种省电模式以适应不同功耗要求的应用。 阅读详情

340 - Master-Mind Hints

Time limit: 3.000 seconds

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=98&page=show_problem&problem=276

MasterMind is a game for two players. One of them, Designer, selects a secret code. The other, Breaker, tries to break it. A code is no more than a row of colored dots. At the beginning of a game, the players agree upon the length N that a code must have and upon the colors that may occur in a code.

In order to break the code, Breaker makes a number of guesses, each guess itself being a code. After each guess Designer gives a hint, stating to what extent the guess matches his secret code.

In this problem you will be given a secret code tex2html_wrap_inline35 and a guess tex2html_wrap_inline37 , and are to determine the hint. A hint consists of a pair of numbers determined as follows.

A match is a pair (i,j), tex2html_wrap_inline41 and tex2html_wrap_inline43 , such that tex2html_wrap_inline45 . Match (i,j) is called strong when i =j, and is called weak otherwise. Two matches (i,j) and (p,q) are called independent when i = p if and only if j = q. A set of matches is called independent when all of its members are pairwise independent.

Designer chooses an independent set M of matches for which the total number of matches and the number of strong matches are both maximal. The hint then consists of the number of strong followed by the number of weak matches in M. Note that these numbers are uniquely determined by the secret code and the guess. If the hint turns out to be (n,0), then the guess is identical to the secret code.

Input

The input will consist of data for a number of games. The input for each game begins with an integer specifying N (the length of the code). Following these will be the secret code, represented as N integers, which we will limit to the range 1 to 9. There will then follow an arbitrary number of guesses, each also represented as N integers, each in the range 1 to 9. Following the last guess in each game will be N zeroes; these zeroes are not to be considered as a guess.

Following the data for the first game will appear data for the second game (if any) beginning with a new value for N. The last game in the input will be followed by a single zero (when a value for N would normally be specified). The maximum value for N will be 1000.

Output

The output for each game should list the hints that would be generated for each guess, in order, one hint per line. Each hint should be represented as a pair of integers enclosed in parentheses and separated by a comma. The entire list of hints for each game should be prefixed by a heading indicating the game number; games are numbered sequentially starting with 1. Look at the samples below for the exact format.

Sample Input

4
1 3 5 5
1 1 2 3
4 3 3 5
6 5 5 1
6 1 3 5
1 3 5 5
0 0 0 0
10
1 2 2 2 4 5 6 6 6 9
1 2 3 4 5 6 7 8 9 1
1 1 2 2 3 3 4 4 5 5
1 2 1 3 1 5 1 6 1 9
1 2 2 5 5 5 6 6 6 7
0 0 0 0 0 0 0 0 0 0
0

Sample Output

Game 1:
    (1,1)
    (2,0)
    (1,2)
    (1,2)
    (4,0)
Game 2:
    (2,4)
    (3,2)
    (5,0)
    (7,0)

学英语:

1. Match (i,j) is called strong when i =j, and is called weak otherwise.

当i=j时,匹配(i,j)被叫做强匹配,反之叫做弱匹配。

2. Two matches (i,j) and (p,q) are called independent when i = p if and only if j = q. A set of matches is called independent when all of its members are pairwise independent.

当i=p时,两个匹配(i,j)和(p,q)被叫做无关的,当且仅当j=q。一个匹配集被称作无关的,当它的所有元素对都是无关的。

3. Designer chooses an independent set M of matches for which the total number of matches and the number of strong matches are both maximal.

设计者选择一个匹配集M,它的总匹配数和强匹配数都是最大的。

4. The hint then consists of the number of strong followed by the number of weak matches in M.

暗示包含强匹配的数目,后面跟着一个弱匹配的数目。


注意:

1. 上面第二句话说明像(5,7)和(5,8)这样不是无关的匹配,不能同时存在于一个匹配集中。

2. 上面第三句话说明计算暗示时,优先计算强匹配的数目。


思路:由于只有9个数字,所以只需要统计每个数字出现的个数即可。

强匹配的数目:相同列相同数字的统计一遍,然后相同列相同数字对应的个数减一。

弱匹配的数目:统计1~9在两序列中出现的个数,每个数字加其再两个序列中出现个数的较小值,详见代码。


完整代码:

/*0.019s*/

#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

int s[1005], g[1005];
int a[15], b[15], c[15];

int main(void)
{
	int cas = 0, n;
	while (scanf("%d", &n), n)
	{
		memset(c, 0, sizeof(c));
		for (int i = 0; i < n; i++)
		{
			scanf("%d", &s[i]);
			c[s[i]]++;
		}
		printf("Game %d:\n", ++cas);
		while (true)
		{
			memcpy(a, c, sizeof(c));// 技巧:用memcpy将c[]中统计的1-9的数的个数赋给a[]
			memset(b, 0, sizeof(b));
			for (int i = 0; i < n; i++)
			{
				scanf("%d", &g[i]);
				b[g[i]]++;
			}
			if (!g[0]) break;
			int x = 0, y = 0;
			for (int i = 0; i < n; i++)
				if (s[i] == g[i])
				{
					a[s[i]]--;
					b[s[i]]--;
					x++;
				}
			for (int i = 1; i <= 9; i++)
				y += min(a[i], b[i]);
			printf("    (%d,%d)\n", x, y);
		}
	}
	return 0;
}

SAP BTP ABAP RAP 开发对象命名规范与落地实践 摘要:SAP BTP ABAP开发中的命名规范实践 在企业级ABAP开发中,命名规范是提升交付效率的工程化手段。SAP推荐采用[/&lt;namespace&gt;/][&lt;prefix&gt;]_&lt;object_name&gt;_[&lt;suffix&gt;]的结构化命名框架,解决多对象、多团队的协同问题。关键实践包括:使用组织专属命名空间避免冲突;通过prefix区分同类型对象的不同语义(如UI_/API_);object_name体现业务语义而非技术细节;suffix表达次级差异。在具体对 阅读详情

相关推荐

卡诺图化简法注意事项+竞争冒险知识点总结

今天反思以下卡诺图化简法中的注意事项。 卡诺图看起来简单,但如果不熟悉的话很容易出错,因此要对画圈的规则比较熟悉。

weixin_42415266的博客 1万+

UVa 340 - Master-Mind Hints

Master-Mind Hints  MasterMind is a game for two players. One of them, Designer, selects asecret code. The other,Breaker, tries to break it. A code is no morethan a row of colored dots. At t

ACM2272902662的专栏 994

f_fs.c 初始化流程(进行中)

前言 之所以选择f_fs.c作为这系列的开始,因为usb在/driver/usb下面的内容实在太多太多,如果讲各种各样点会太分散了。所以决定切入点以实际使用为主,就是f_fs了,目前我了解这是做bulk裸传输使用的,具体的通信协议自己确定。 初始化部分 开始点从这个路径下说起, /drivers/usb/gadget/function/f_fs.c 然后f_fs.c第一个使用的是include/composite.h中的宏定义function #define DECLARE_USB_FUNCTION(_n

weixin_36406973的博客 1967

算典03_例题_04_Uva-340

猜数字游戏 数字对且位置也对的个数--直接对比答案和猜的数组即可 数字对但是位置不对的个数 这个时候需要遍历i(1~9),每次遍历,都寻找两个数组里等于i的元素个数,将得到的较小的那个元素个数加入结果中去,遍历完得到的结果便是只考虑数字而不考虑位置的个数,用它减去之前数字对且位置也对的个数,即为数字对但位置不对的个数

duaduac.com 414

从RRT到平滑轨迹:机械臂避障规划仿真全流程解析

本文详细解析了机械臂避障规划从RRT算法到平滑轨迹优化的全流程,包括MATLAB实现、碰撞检测工程实践及轨迹平滑优化技巧。通过RRT算法在关节空间的路径搜索与Minimum Jerk/Snap优化,实现机械臂在复杂环境中的高效安全运动,适用于工业自动化与机器人控制领域。

weixin_29051811的博客 294

NLM去噪算法:原理、优化与医学图像处理实战

本文深入解析NLM去噪算法的核心原理及其在医学图像处理中的优化应用。通过全局自相似性计算,NLM算法有效抑制噪声并保留细节,特别适用于超声图像斑点噪声处理。文章还介绍了积分图像和傅里叶变换等优化技巧,显著提升计算效率,并分享医学影像项目中的实用调参经验。

weixin_29051149的博客 348

4.猜数字游戏的提示MasterMind

MasterMind is a game for two players. One of them, Designer, selects a secret code. The other, Breaker, tries to break it. A code is no more than a row of colored dots. At the beginning of a game, the

小女不才 1062

告别Python依赖!用C++编译PaddleOCR打造轻量级本地OCR工具(附模型选择与性能对比)

本文详细介绍了如何将PaddleOCR从Python迁移到C++平台,打造高性能、低资源占用的本地OCR工具。通过对比Python和C++实现的性能差异,展示了C++在冷启动时间、内存占用和部署便捷性上的显著优势。文章还提供了模型选择、编译配置和优化技巧等实用指南,帮助开发者轻松构建轻量级OCR解决方案。

weixin_28717467的博客 256

例题3-4 猜数字游戏的提示 UVa340

算法竞赛入门经典(第2版)第3章 数组和字符串 例题3-4 猜数字游戏的提示 UVa340 感悟。 1、自认为这个程序写得还可以。 2、开始阶段一团浆糊,只能从数据的输入输出入手,先整理好输入输出格式。 3、进行输入输出测试阶段,输入太繁琐,果断改成采用文件的方式(FILE *fin)输入数据,测试成功,提交时,再改成标准输入。 4、程序是每当输出结果不符要求,调试,输出结果还不符

mrcrack的博客 2695

ComfyUI入门学习-教程篇

深入的 ComfyUI 教程,不同功能节点的详细指南。一个比较有意思的Comfyui教程,动画式学习。从安装到基础教程、高级教程再到各种工作流。非常全面,有教程有搭建好的工作流。

wincyfu的博客 1330

【图像去噪】论文精读:Restormer: Efficient Transformer for High-Resolution Image Restoration

论文题目:Restormer: Efficient Transformer for High-Resolution Image Restoration —— Restormer:用于高分辨率图像恢复的高效变压器高效Transformer模型用于图像恢复!由于卷积神经网络 (CNN) 在从大规模数据中学习可泛化的图像先验方面表现良好,因此这些模型已广泛应用于图像恢复和相关任务。最近,另一类神经架构 Transformer 在自然语言和高级视觉任务中显示出显着的性能提升。

主要更新底层视觉(去噪、超分等)相关的科研内容,形式为【论文精读】+【论文复现】 1526

uva340 - Master-Mind Hints

MasterMind is a game for two players. One of them, Designer, selects a secret code. The other,Breaker, tries to break it. A code is no more than a row of colored dots. At the beginning of a game, the

uva code 2737

YOLO11改进策略【独家融合改进】| RCSOSA + SPD + WFU

SPD-Conv是一种新的 CNN 构建模块,用于替代传统 CNN 架构中使用的步长卷积(strided convolution)和池化(pooling)层,它由空间到深度(Space-to-depth,SPD)层和非步长卷积(non - strided convolution)层组成。WFU模块通过小波变换的频率分解与跨尺度融合机制,解决了传统上采样过程中的混叠和细节丢失问题,实现了高效、高保真的面部细节重建。

Limiiiing的博客 450

排序检索A - Master-Mind Hints

MasterMind is a game for two players. One of them, Designer, selects a secret code. The other, Breaker, tries to break it. A code is no more than a row of colored dots. At the beginning of a game, th

katydid3018的博客 338

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

UVA340-Master-Mind Hints(紫书例题3.4)

MasterMind is a game for two players. One of them, Designer, selects a secret code. The other, Breaker, tries to break it. A code is no more than a row of colored dots. At the beginning of a game, the...

独钓门前月 563

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain&#39;s apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = &quot;R. B. Palm&quot;, title = &quot;Prediction as a candidate for learning deep hierarchical models of data&quot;, year = &quot;2012&quot;,}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath(&#39;DeepLearnToolbox&#39;));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand(&#39;state&#39;,0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W&#39;); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand(&#39;state&#39;,0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = &#39;sigm&#39;;%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er &lt; 0.10, &#39;Too big error&#39;);```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand(&#39;state&#39;,0)sae = saesetup([784 100]);sae.ae{1}.activation_function = &#39;sigm&#39;;sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)&#39;)% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;;nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er &lt; 0.16, &#39;Too big error&#39;);```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x&#39;,28,28,60000))/255;test_x = double(reshape(test_x&#39;,28,28,10000))/255;train_y = double(train_y&#39;);test_y = double(test_y&#39;);%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you&#39;ll get around 1.2% errorrand(&#39;state&#39;,0)cnn.layers = { struct(&#39;type&#39;, &#39;i&#39;) %input layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 6, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %sub sampling layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 12, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er&lt;0.12, &#39;Too big error&#39;);```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er &lt; 0.08, &#39;Too big error&#39;);%% ex2 neural net with L2 weight decayrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er &lt; 0.1, &#39;Too big error&#39;);%% ex3 neural net with dropoutrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er &lt; 0.1, &#39;Too big error&#39;);%% ex4 neural net with sigmoid activation functionrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er &lt; 0.1, &#39;Too big error&#39;);%% ex5 plotting functionalityrand(&#39;state&#39;,0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = &#39;softmax&#39;; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er &lt; 0.1, &#39;Too big error&#39;);%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand(&#39;state&#39;,0)nn = nnsetup([784 20 10]); nn.output = &#39;softmax&#39;; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er &lt; 0.1, &#39;Too big error&#39;);```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free &quot;Bitdeli Badge&quot;)

Mastermind游戏

Mastermind Game

wuyongpeng的专栏 6688

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

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

*UVa 340 Master-Mind Hints(例题3-4)

为什么要加星号?因为这道题的算法和书上大致上是差不多的,不一样的地方是我把输入数组换成读入的时候统计而已 但是在oj上一直通不过,这我就很懵逼了,也不想把书上的代码打一遍,反正基本上差不多,自己对照一下书上吧 至于为什么是取最小的一个?应该是“同时出现”,所以取比较小的数据相加得到数字的贡献 PS:如果发现代码有哪里出现问题请在评论里联系我,谢谢,因为我自己也不知道哪里的问题,oj上的测试数

Dream of Decision 325

紫书第三章训练2 暴力集

A - Master-Mind Hints MasterMind is a game for two players. One of them,Designer, selects a secret code. The other,Breaker, tries to break it. A code is no more than a row of colored dots. At the b...

weixin_34364135的博客 680

UVA340 UVALive5448 Master-Mind Hints【水题】

  MasterMind is a game for two players. One of them, Designer, selects a secret code. The other, Breaker, tries to break it. A code is no more than a row of colored dots. At the beginning of a game, t...

海岛Blog 1430

刷紫书第三章例题(例题3-4,3-5,3-6)

例题3-4 Master-Mind Hints UVA - 340发顺丰

ccnuacmhdu的博客 864

UVA 340 Master-Mind Hints 猜数字提示的游戏 简单模拟

题意:以前曾经玩过的一个游戏,就是猜数字,原来的游戏规则是这样的: 請寫一個猜數字遊戲,電腦會產生一個四位數且每個數字都不重複的數字讓使用 者去猜,使用者猜測一組數字後,電腦會顯示 ?A?B 的訊息,A 代表正確的數字 數目,B 代表數字正確但位置不對的數字數目。 这边有个在线玩的网站:请戳这里,可能玩过了就会有点感觉了。 题目有点不同,它给出的密码是多位的,然后给出一系列的猜测,让

水果君の日常 3165

340 - Master-Mind Hints

Master-Mind Hints  MasterMind is a game for two players. One of them, Designer, selects asecret code. The other, Breaker, tries to break it. A code is no morethan a row of colored dots. At

SD_Sunny_hui的专栏 1056

猜数字游戏的提示(Master-Mind Hints, UVa 340)

Written by Robert_Wang in Southwest University of Science And Technology.实现一个经典&quot;猜数字&quot;游戏。给定答案序列和用户猜的序列,统计有多少数字位置正确(A),有多少数字在两个序列都出现过但位置不对(B)。输入包含多组数据。每组输入第一行为序列长度n,第二行是答案序列,接下来是若干猜测序列。猜测序列全0时该组数据结束。n=0时...

乌云踏雪 736

Master-Mind Hints(猜数字游戏的提示)

MasterMind is a game for two players. One of them, Designer, selects a secret code. The other, Breaker, tries to break it. A code is no more than a row of colored dots. At the beginning of a game, the...

weixin_33716941的博客 297
上一篇: 程序员眼中的酒席
下一篇: while(cin>>val)的调用机理
synapse7
博客等级 码龄14年 432粉丝 701原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值