secret和guess按位读入,如果相等bull就加1,不相等就在各自统计不同数字出现次数的数组里加1(s_map[i]指secret里数字i出现的次数)。最后s_map和g_map存的是各自string中位置不等的各数值出现的次数,cow等于两个数组中相同位置的最小数。
分类:
其他好文 时间:
2016-03-20 21:22:25
阅读次数:
203
from random import randintnum = randint(0,100)print("Guess what I think:?")bingo = Falsewhile bingo == False: answer = int(input()) if answer < num: p
分类:
编程语言 时间:
2016-03-09 15:40:42
阅读次数:
149
题目: You are playing the following Bulls and Cows game with your friend: You write down a number and ask your friend to guess what the number is. Each
分类:
其他好文 时间:
2016-03-06 19:08:46
阅读次数:
182
* while 循环 # while expression: statement(s) 猜数字 #!/usr/bin/env python # -*- coding: utf-8 -*- import random number = random.randint(1,101) guess=0 whi...
分类:
其他好文 时间:
2016-03-03 19:07:50
阅读次数:
238
本文是在学习中的总结,欢迎转载但请注明出处:http://blog.csdn.net/pistolove/article/details/50768550
You are playing the following Bulls and Cows game with your friend: You write down a number and
ask your friend to guess what the number is. Each time your friend...
分类:
其他好文 时间:
2016-02-29 23:24:00
阅读次数:
233
本文全然没有技术含量,纯粹是娱乐。 我事实上想写点东西。可是近期好像做计算几何做得太多了,一种想说说不出东西的感觉,唯有写一下一些奇葩的题目了。 HDU3337:Guess the number http://acm.hdu.edu.cn/showproblem.php?pid=3337 题目意思:
分类:
其他好文 时间:
2016-02-27 17:51:09
阅读次数:
173
You are playing the following Bulls and Cows game with your friend: You write down a number and ask your friend to
guess what the number is. Each time your friend makes a guess, you provide a hint t...
分类:
其他好文 时间:
2016-02-25 10:22:12
阅读次数:
142
题 题意 有个1到n的一个全排列,告诉你第i个数和全部n个数相比的较小的是哪个,和自己相比时为0,于是有个主对角线为0的矩阵,求原数列 分析 我的想法是,给我们的每一行之和按大小排一下,就知道第i个数是数列里第几大的了。因为是n的全排列,所以第几大就是几。 按sum排完序后,r[sum[i].id]
分类:
其他好文 时间:
2016-02-12 06:05:22
阅读次数:
253