UVA-340 Master-Mind Hints (猜数字)
来源:互联网 发布:黑马程序员web前端 编辑:程序博客网 时间:2024/04/30 02:32
分析:猜数字游戏,水题
#include<cstdio> #include<algorithm> #include<map> using namespace std; const int N = 1005; int a[N], b[N], c, d; int main() { int n, cas = 0; while (scanf ("%d", &n), n) { map<int, int> aa; printf ("Game %d:\n", ++cas); for (int i = 0; i < n; ++i) { scanf ("%d", &a[i]); ++aa[a[i]]; } while (1) { map<int, int> bb; for (int i = c = d = 0; i < n; ++i) { scanf ("%d", &b[i]); ++bb[b[i]]; if (a[i] == b[i]) c++; } if (!b[0]) break; for (int i = 1; i <= 9; ++i) d += min (aa[i], bb[i]); printf (" (%d,%d)\n", c, d - c); } } return 0; }
0 0
- UVA-340 Master-Mind Hints (猜数字)
- UVa 340 Master-Mind Hints(猜数字游戏的提示)
- 猜数字游戏的提示 (Master-Mind Hints, UVa 340)
- UVa 340 猜数字游戏提示(Master-Mind-Hints)
- UVa Master-Mind Hints(猜数字+计数)
- uva 340 Master-Mind Hints(检索)
- Master-Mind Hints(UVa 340)
- uva 340 Master-Mind Hints(猜数串)
- 猜数字游戏的提示(Master-Mind Hints , UVa 340)
- 猜数字游戏的提示(Master-Mind Hints, UVa 340)
- 猜数字游戏的提示(Master-Mind Hints, UVa 340)
- uva 340 -----Master-Mind Hints(猜数字游戏的提示)
- UVa 340 Master-Mind Hints
- uva 340 Master-Mind Hints
- UVA 340 - Master-Mind Hints
- UVa 340 - Master-Mind Hints
- UVa 340 Master-Mind Hints
- UVA 340 Master-Mind Hints
- 二分查找(折半查找)
- C标准库没提供的助手函数:字符串替换
- urllib.urlretrieve()
- C语言实现用星号在屏幕上打印菱形
- [leetcode] 22. Generate Parentheses 解题报告
- UVA-340 Master-Mind Hints (猜数字)
- 开始一个新的地方作为自己技术的心灵园田,新浪微博太伤我心了
- UVA-10420 List of Conquests
- UVA-152 Tree's a Crowd
- UVA 299 Train Swapping
- pyqt桌面开发--HelloWorld
- UVA 755 487--3279
- Rails(UVa514)(栈)
- UVA 657 The die is cast (DFS*2)