题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=98&page=show_problem&problem=276
C++ AC。先遍历对比一遍得出strong的数量,然后对每个数字一次遍历weak的情况,一旦match之后都置为-1,以避免重复计算。
#include<cstdio> const int MAX = 1005; int code[MAX]; int main() { setbuf(stdout,NULL); int n; int counter = 1; while (scanf("%d", &n)) { if (n == 0) break; for (int i = 0; i < n; i++) scanf("%d", &code[i]); printf("Game %d:\n", counter++); int guess[MAX]; while (true) { for (int i = 0; i < n; i++) scanf("%d", &guess[i]); if (guess[0] == 0) break; int tmpCode[MAX]; for (int i = 0; i < n; i++) tmpCode[i] = code[i]; //determint the hint int strong = 0, weak = 0; for (int i = 0; i < n; i++) { if (tmpCode[i] == guess[i]) { strong++; tmpCode[i] = guess[i] = -1; } } for (int i = 0; i < n; i++) if (guess[i] != -1) { for (int j = 0; j < n; j++) { if (guess[i] == tmpCode[j]) { weak++; guess[i] = tmpCode[j] = -1; break; } } } printf(" (%d,%d)\n",strong,weak); } } return 0; }
相关推荐
maven-hints-3.1.4-sources.jar
maven-hints-3.1.1-sources.jar
$ npm install --save-dev resource-hints-webpack-plugin 用yarn安装插件: $ yarn add --dev resource-hints-webpack-plugin 基本用法 加载插件 const ResourceHintWebpackPlugin = require ( 'resource-hints-...
maven-hints-3.1.4.jar
maven-hints-3.1.1.jar
:rocket: 安装npm i vue-dom-hints :vertical_traffic_light: 设置将其作为安装到Vue: import DomHints from 'vue-dom-hints'Vue . use ( DomHints ) 在构建中将其禁用以进行生产: if ( process . env . NODE_ENV...
语言:English ... 有关客户端 - 提示提案,请参阅https://github.com/igrigorik/http-client-hints 扩展的源代码可以在github上找到 - https://github.com/andydavies/client-hints-拉出请求欢迎。
向传出请求添加HTTP客户端提示头。 扩展,允许设置Client-Hints标头用于测试/实验目的。 ... ...可在GitHub上找到扩展的源代码-https://github.com/andydavies/Client-Hints-拉取请求欢迎。 支持语言:English
阵列服务器集群中的死锁问题比较讨厌;而其与性能之间的PK是个人类无奈的话题。需找一些相应的适中机制比较好玩。
安装对于不耐烦的人,这是一个快速设置示例(在将indent-hints.el放入您的加载路径之后): (require 'indent-hints) (add-hook 'c-mode-common-hook 'indent-hints-activate)您可能至少应该自定义indent-hints-mode...
npm install react-hints --save 用法 将react-hints导入您的组件。 import Hint from 'react-hints' ; 在渲染中,使用组件包装一些元素。 这是包装的<button /> : < button className = "btn btn-lg...
pip install no_string_hints 作为预提交挂钩 有关说明,请参阅 样本.pre-commit-config.yaml : - repo : https://github.com/MarcoGorelli/no-string-hints rev : v0.1.7 hooks : - id : no-string-hints ...
$ npm i root-hints 用法 const rootHints = require ( 'root-hints' ) ; rootHints ( 'A' ) ; // ['198.41.0.4', '192.228.79.201', ...] rootHints ( 'AAAA' ) ; // ['2001:503:BA3E::2:30', '2001:500:84::B', .....
#WooCommerce模板提示# ##描述 ## 如果此插件处于活动状态,则将在WooCommerce使用的每个模板周围插入一个框架,显示文件名。 默认的WooCommerce模板为红色,被覆盖的模板为蓝色。 将鼠标悬停在模板名称上...
sql error can be handled
- 使用示例 `java -jar sfnttool.jar -f a.txt Alibaba-... -h,-hints Strip hints -w,-woff Output WOFF format -e,-eot Output EOT format -x,-mtx Enable Microtype Express compression for EOT format
Hints优化.pdf
Magento 模板提示切换器 这个书签是切换 Magento 模板提示可见性的最简单方法。 你需要两件事: 你需要安装这个插件: 。 只需将其克隆到您的 cms 应用程序目录树中即可同步 然后将带有以下 URL 的书签添加到...
搜索Brackets WordPress Functions Hints 。 安装。 或者将此存储库克隆到您的扩展目录中。参考WordPress代码参考/变更日志版本1.0.2 添加WordPress 4.3的新功能版本1.0.1 添加WordPress 4.2的新功能版本1.0.0 初始...