码迷,mamicode.com
首页 >  
搜索关键字:guess    ( 609个结果
三道关于类与方法的例题
三道类与方法的例题 猜数字游戏:一个类A有两个成员变量v、num,v有一个初值100。定义一个方法guess,对A类的成员变量v,用num进行猜。如果大则提示大了,小了则提示小了。等于则提示猜测成功。 在main方法中测试。 猜数字游戏:一个类A有两个成员变量v、num,v有一个初值100。定义一个 ...
分类:其他好文   时间:2019-05-22 22:34:42    阅读次数:253
任性玩 while
age_of_me = 17 count = 0 while count age_of_me: print("guess smaller") else: print("guess bigger") count +=1 if count == 5: countine_confirm = input("... ...
分类:其他好文   时间:2019-05-18 00:46:57    阅读次数:153
leetcode [299]Bulls and Cows
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 ...
分类:其他好文   时间:2019-05-14 20:44:43    阅读次数:174
18-猜数,直到猜对。
import randomnum = random.randint(1,10)running = Truewhile running: answer = int(input('guess the number: ')) if answer > num: print('猜大了') elif answe... ...
分类:其他好文   时间:2019-05-14 13:01:43    阅读次数:91
13-猜数:基数的实现
import randomnum = random.randint(1,10) # 随机生成1-10之间的数字。answer = int(input('guess a number: ')) # 将用户输入的字符转成整数。if answer > num: print('猜大了')elif answe... ...
分类:其他好文   时间:2019-05-13 16:30:28    阅读次数:117
学习python的第五天
4.30自我总结 一复习 1.查看数据类型 2.关于变量的一些补充 二.数据类型 1.数字类型 a)整型(int) 1.作用 表示年龄,身高,体重等等 2.定义 3.运算 b)浮点型(float) 1,作用 表示称重,长度精确需要用到小数点时候等等 2.定义: 3.算法与整数型相同 4.补充算法 2 ...
分类:编程语言   时间:2019-04-30 18:35:46    阅读次数:141
E - Guess the Root 拉格朗日差值法+交互
题目传送门 题意:告诉你存在一个未知项系数最高为10的$f(x)$,你最多可以有50次询问,每次询问给出一个$x'$,系统会返回你$f(x')$的值,你需要猜一个$x''$,使得$f(x'')=0$,所有运算都是取模1e6+3下进行的。 思路:拉格朗日插值法的模板题。yyb聚聚的公式 $p(x)=\ ...
分类:其他好文   时间:2019-04-23 21:22:09    阅读次数:224
C#流程控制语句--迭代语句(while,do....while, for , foreach)
迭代语句:有的时候,可能需要多次执行同一块代码。函数中的第一个语句先执行,接着是第二个语句,依此类推。 迭代语句:while(先检查后执行) while(条件表达式 bool类型) { 代码语句 } For example 迭代语句:do....while(先执行后检查至少执行一次) do { 代码 ...
分类:Windows程序   时间:2019-04-16 01:25:45    阅读次数:185
python-if判断
# -*- coding:utf-8 -*-# Author:DliYaoimport getpass'''_username = "dengliyao"_password = "dly"username = input("username: ")#password = getpass.getpas ...
分类:编程语言   时间:2019-04-14 15:59:43    阅读次数:126
UVA11995 I Can Guess the Data Structure!
思路 简单题,用栈,队列,优先队列直接模拟即可 代码 cpp include include include include include using namespace std; queue q; stack S; priority_queue pq; int n; int main(){ wh ...
分类:其他好文   时间:2019-04-10 09:13:05    阅读次数:136
609条   上一页 1 ... 8 9 10 11 12 ... 61 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!