摘要: 二分查找与二分答案 第一种就是普通的二分查找就是进行左右边界的判断,其中第一种就是进行往左找,第二种往右找,之后用区间进行判断之后按照片条件进行选择,其中二分查找的最重要的就是有单调性。 / bool binery_serch1(int x) { int l=0,r=n-1; while(l<r) 阅读全文
posted @ 2024-01-24 15:56 记录菜鸟成长 阅读(33) 评论(0) 推荐(0)
摘要: #方法一: lst=['88','89','90','98','00','99'] for i in range(len(lst)):#永昌成都直接遍历 if lst[i]==0: lst[i]='200'+lst[i] else : lst[i]='19'+lst[i] print(lst) #方 阅读全文
posted @ 2024-01-18 11:03 记录菜鸟成长 阅读(15) 评论(0) 推荐(0)
摘要: ''' 列表 可变序列 可重复 有序 【】 ''' import operator #创建列表的第一方式 lst=['hello','word,',98] print(lst) print(lst[0],lst[-3]) #顺着进行是0 1 2 3 4 5 6 7逆着数是-1 -2 -3 -4 #创 阅读全文
posted @ 2024-01-17 21:28 记录菜鸟成长 阅读(12) 评论(0) 推荐(0)
摘要: # # for i in range(5):#外层循环可以进行5次 i默认从0开始 # for j in range(1,11): # if j%2==0: # continue # print(j,end='\t') # print() # ''' # 要求输出1到50之间所有5的倍数 # ''' 阅读全文
posted @ 2024-01-16 20:43 记录菜鸟成长 阅读(44) 评论(0) 推荐(0)
摘要: # answer=input('你是会员名y/n') # #pass是空语句 # if(answer=='y'): # pass # else : # pass ''' 只要是空的就是False ''' print(bool(False)) print(bool(0)) print(bool(0.0 阅读全文
posted @ 2024-01-16 20:04 记录菜鸟成长 阅读(24) 评论(0) 推荐(0)
摘要: import decimal from decimal import Decimal a=eval(input('请输入你要计算的第一个数值:')) b=eval(input('请输入你要计算的第二个数值:')) print(Decimal(str(a))+Decimal(str(b))) #输入函 阅读全文
posted @ 2024-01-16 10:50 记录菜鸟成长 阅读(14) 评论(0) 推荐(0)
摘要: import keyword from decimal import Decimal print(520) print('hellow word') print('hello word') fp=open('D:\\text.txt','a+') # print('hellow',file=fp) 阅读全文
posted @ 2024-01-16 09:20 记录菜鸟成长 阅读(18) 评论(0) 推荐(0)
摘要: import java.util.Scanner; public class Main{ public static void main(String args[]) { Scanner sc=new Scanner(System.in); String s="1233.32"; double y= 阅读全文
posted @ 2023-09-09 21:19 记录菜鸟成长 阅读(42) 评论(0) 推荐(0)