首页 > 其他分享 >Day 21

Day 21

时间:2022-11-29 21:00:39浏览次数:30  
标签:quit 21 int age num print input Day

2022.11.29 开学倒计时67天

上午学不下去东西做了规划,

14:30-14:40补完了昨晚闭馆剩下的一条习题,

按计划14:40-15:40文学院教材(外国文学,20-25天读完),15:55-16:55文学院公开课《说文解字》(预计15天看完,附录音韵学需定夺),17:35-17:50名著-索福克勒斯悲剧

晚饭,19:10-20:10 python,20:10-20:50 leetcode

 7-1

car = input('what kind of car do you need?:')
print("let me see if i can find you a " + car)

 7-2

num = input('how many people will you come?:')
if int(num) > 8:
    print("no empty table")
else:
    print("welcome")

 7-3

num = input('input a number:')
if (int(num) % 10) == 0:
    print("it's mutiple of 10")
else:
    print("no")

 

 7-4

topping = ''
while topping != 'quit':
    topping = input('what you wanna add?:')
    if topping == 'quit':
        print('end')
    else:
        print('we will add: ' + topping)

 7-5

age = ''
flag = True
while age != 'quit':
    age = input('how old are you?:')
    if age == 'quit':
        flag = False
    if flag == False:
        print('end')
    else:
        age = int(age)
        if age < 3:
            print('you are free')
        elif ((age >= 3) & (age <= 12)):
            print('offer 10 dollar')
        elif age > 12:
            print('offer 15 dollar')

 7-6

active = True
age = ''
while active == True:
    age = input('how old are you?:')
    if age == 'quit':
        active = False
        print('end')
        break
    else:
        age = int(age)
        if age < 3:
            print('you are free')
        elif ((age >= 3) & (age <= 12)):
            print('offer 10 dollar')
        elif age > 12:
            print('offer 15 dollar')

7-7

age = ''
flag = True
while age != 'quit':
    age = input('how old are you?:')
    if age == 'quit':
        flag = False
    while flag == True:
        age = int(age)
        if age < 3:
            print('you are free')
        elif ((age >= 3) & (age <= 12)):
            print('offer 10 dollar')
        elif age > 12:
            print('offer 15 dollar')
    if flag == False:
        print('end')

leetcode

 2475. 数组中不等三元组的数目

暴力:

int unequalTriplets(int* nums, int numsSize){
    int first,second,third;
    int num = 0;
    for(int i = 0; i < numsSize - 2; i++){
        first = nums[i];
        for(int j = i + 1; j < numsSize - 1; j++){
            second = nums[j];
            for(int k = j + 1; k < numsSize; k++){
                third = nums[k];
                if((first != second) && (second != third) && (first != third)){
                    num++;
                }
            }
        }
    }
    return num;
}

 还有个哈希表的写法,看了半个小时才看懂,明天试试看能不能复刻

 

标签:quit,21,int,age,num,print,input,Day
From: https://www.cnblogs.com/IslandNeo/p/16935889.html

相关文章

  • 20221128 Maven - 尚硅谷(9-10)
    9.重新认识MavenMaven的完整功能在入门的时候我们介绍说Maven是一款『构建管理』和『依赖管理』的工具。但事实上这只是Maven的一部分功能。Maven本身的产品定......
  • 20221129 Maven - 尚硅谷【归档】
    参考资料尚硅谷2022版Maven教程(maven入门+高深,全网无出其右!)Maven官网POM参考mvnrepository代码重工前言视频时间:2022-2版本信息当前最新版本:3.8......
  • Day26:内部类的详解
    内部类1.1内部类概述内部类:就是在一个类中定义另外一个类。例如我们在A类中定义一个B类,那么B类就是A类的内部类,A则是B的外部类。好比我们的手机是一个类,而手机内部的零......
  • 每日食词—day010
    insteadadv.代替、改为、反而.enterprisen.企业、企业版、企业号.setTimeoutn.定时器、计时器vendorn.供应商、厂商、小贩、卖方.cachen. v.缓......
  • 每日食词—day009
    scrolln. v.屏幕滚动、滚动、条幅、卷动.topicn.主题、话题、专题、题目.productionn.生产、制作.operationn.操作、作业、运算、运营.available......
  • day44MySQL基础(6)
    SQL注入问题怪像1:输对用户名就可以登录成功怪像2:不需要对的用户名和密码也可以登录成功SQL注入:利用特殊符合的组合产生特殊的含义从而避开正常的业务逻辑sel......
  • [资料] 设计原理图资料保存:FMC210-1路1Gsps AD、1路2.5Gsps DA的FMC子卡解决方案
    FMC210-1路1GspsAD、1路2.5GspsDA的FMC子卡  一、板卡概述   FMC-1AD2DA是北京太速科技自主研发的一款1路1GAD采集、1路2.5GDA回放的FMC子......
  • day07_java_数组
    d07Java数组(p51-p59)1.什么是数组?数组就是一组数的集合。数组是相同类型数据的有序集合。数组描述的是相同类型的若干个数据,按照一定的先后顺序排列组合而成。......
  • [Typescript] 121. Hard - IsPalindrome
    Implementtype IsPalindrome<T> tocheckwhetherastringornumberispalindrome.Forexample:IsPalindrome<'abc'>//falseIsPalindrome<121>//true /*......
  • day1
    Markdown二级标题三级标题字体Hello,World!Hello,World!Hello,World!-Hello,World!-Hello,World!超链接ssss代码pablic......