From d2a22c0249787f2226701bc0279da980cc8a1959 Mon Sep 17 00:00:00 2001
From: big <1638587056@qq.com>
Date: Fri, 12 Jul 2024 18:54:25 +0800
Subject: [PATCH] Signed-off-by: big <1638587056@qq.com>
---
.idea/.gitignore | 3 +
.../inspectionProfiles/profiles_settings.xml | 6 ++
.idea/misc.xml | 4 ++
.idea/modules.xml | 8 +++
.idea/python程序.iml | 10 +++
20240629.py | 19 ++++++
20240629排序.py | 7 +++
20240630打砖块-砖块的制作.py | 62 +++++++++++++++++++
20240702.py | 15 +++++
20240703.py | 10 +++
20240704.py | 19 ++++++
20240704b.py | 30 +++++++++
20240706.py | 18 ++++++
20240706b.py | 21 +++++++
20240709b递归.py | 13 ++++
20240709递归.py | 27 ++++++++
20240710.py | 25 ++++++++
20240712.py | 29 +++++++++
main.py | 16 +++++
19 files changed, 342 insertions(+)
create mode 100644 .idea/.gitignore
create mode 100644 .idea/inspectionProfiles/profiles_settings.xml
create mode 100644 .idea/misc.xml
create mode 100644 .idea/modules.xml
create mode 100644 .idea/python程序.iml
create mode 100644 20240629.py
create mode 100644 20240629排序.py
create mode 100644 20240630打砖块-砖块的制作.py
create mode 100644 20240702.py
create mode 100644 20240703.py
create mode 100644 20240704.py
create mode 100644 20240704b.py
create mode 100644 20240706.py
create mode 100644 20240706b.py
create mode 100644 20240709b递归.py
create mode 100644 20240709递归.py
create mode 100644 20240710.py
create mode 100644 20240712.py
create mode 100644 main.py
diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..359bb53
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,3 @@
+# 默认忽略的文件
+/shelf/
+/workspace.xml
diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml
new file mode 100644
index 0000000..105ce2d
--- /dev/null
+++ b/.idea/inspectionProfiles/profiles_settings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..ab530bf
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..ce84d4b
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/python程序.iml b/.idea/python程序.iml
new file mode 100644
index 0000000..96b804c
--- /dev/null
+++ b/.idea/python程序.iml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/20240629.py b/20240629.py
new file mode 100644
index 0000000..00389a8
--- /dev/null
+++ b/20240629.py
@@ -0,0 +1,19 @@
+#插入排序
+
+num = [13,2,8,12,1,456,89]
+for i in range(1,len(num)):
+ key = num[i] #获取未排序部分的第一项值
+ j = i-1 #设置已排序部分的最后一位编号
+ print("需要插入的值:", key)
+ while j>=0 and num[j] d1[l1[i+1]]:
+ d1[l1[i]],d1[l1[i+1]] = d1[l1[i+1]],d1[l1[i]]
+print(d1)
\ No newline at end of file
diff --git a/20240630打砖块-砖块的制作.py b/20240630打砖块-砖块的制作.py
new file mode 100644
index 0000000..17141af
--- /dev/null
+++ b/20240630打砖块-砖块的制作.py
@@ -0,0 +1,62 @@
+import sys
+
+import pygame
+#初始化pygame
+pygame.init()
+#初始化显示
+pygame.display.init()
+#创建显示窗口
+sc = pygame.display.set_mode((400,300))
+#创建时钟对象
+clock = pygame.time.Clock()
+#设置变量运行游戏为真
+is_running = True
+
+#砖块初始化
+zk_x = 7.5#第一块转的x坐标
+zk_y = 5#第一块转的y坐标
+zk_w = 30#砖块的宽度
+zk_h = 10#砖块的高度
+zk_list = []#初始化砖块列表
+#行
+for j in range(4):
+ #列
+ for i in range(11):
+ r = pygame.Rect(zk_x,zk_y,zk_w,zk_h)#创建砖块的矩形区域
+ zk_list.append(r)#将矩形区域加入列表中
+ zk_x += 35#更新x坐标
+ zk_y += 15#更新y坐标
+ zk_x = 7.5#重置x坐标
+
+ballx = 200#小球的x坐标
+bally = 150#
+ball_speed_x = 2#
+ball_speed_y = 2#
+
+#游戏主循环
+while is_running:
+ #背景填充黑色
+ sc.fill("black")
+ #遍历砖块列表
+ for z in zk_list:
+ #绘制砖块
+ pygame.draw.rect(sc,"white",z)
+
+ ball = pygame.draw.circle(sc, "white", (ballx, bally), 5)
+ ballx = ballx + ball_speed_x
+ bally = bally + ball_speed_y
+ if ballx > 395 or ballx < 5 :
+ ball_speed_x = -ball_speed_x
+ if bally > 295 or bally < 5 :
+ ball_speed_y = -ball_speed_y
+
+ #遍历事件
+ for event in pygame.event.get():
+ #如果事件为退出事件
+ if event.type == pygame.QUIT:
+ is_running = False
+ pygame.display.flip()#显示更新
+ clock.tick(60)#设置更新帧率为60
+
+pygame.quit()#结束pygame初始化
+sys.exit()#结束系统进程
\ No newline at end of file
diff --git a/20240702.py b/20240702.py
new file mode 100644
index 0000000..2a9624f
--- /dev/null
+++ b/20240702.py
@@ -0,0 +1,15 @@
+h = int(input())
+m = int(input())
+s = int(input())
+k = int(input())
+s += k
+if s >= 60:
+ s = s-60
+ m += s//60
+ s = s%60
+ if m >= 60:
+ h += m//60
+ m = m%60
+print(h,m,s)
+
+
diff --git a/20240703.py b/20240703.py
new file mode 100644
index 0000000..eed32e6
--- /dev/null
+++ b/20240703.py
@@ -0,0 +1,10 @@
+# 循环变量,用于记录每一次循环的数据
+# 0 <= a < 100\
+l1 = [12,45,67,89,0,34,56]
+m = 0
+for i in l1:
+ if i>m:
+ m = i
+
+print(m)
+
diff --git a/20240704.py b/20240704.py
new file mode 100644
index 0000000..ac4da4c
--- /dev/null
+++ b/20240704.py
@@ -0,0 +1,19 @@
+import turtle
+turtle.title("多边形")
+turtle.bgcolor("black") # 设置背景颜色
+turtle.speed(0) # 设置画笔速度
+turtle.penup() # 抬笔
+turtle.pendown() # 落笔
+turtle.pencolor("white")# 设置画笔颜色
+a = turtle.numinput("边数","请问需要绘制几边形") #获取用户输入,得到的是浮点型数据
+a = int(a)#将变量a转换为整数类型
+b = turtle.numinput("花瓣数量","这朵花有几个花瓣")
+b = int(b)# 将b转换为整数
+for j in range(b):
+ for i in range(a):
+ turtle.forward(100)#前进
+ turtle.left(360/a)#左转
+ turtle.left(360/b)
+turtle.penup()
+
+turtle.mainloop()
diff --git a/20240704b.py b/20240704b.py
new file mode 100644
index 0000000..4f5f981
--- /dev/null
+++ b/20240704b.py
@@ -0,0 +1,30 @@
+'''
+#print(round(132.56,-3))
+n = int(input())
+nums = []
+for i in range(n):
+ a = int(input())
+ nums.append(a)
+for i in nums:
+ f=0
+ for j in range(1,i+1):
+ for k in range(1,i+1):
+ if j*j + k*k == i:
+ f = 1
+ print("Yes")
+ break
+ if f == 1:
+ break
+ else:
+ print("No")'''
+
+N = int(input())
+k = int(input())
+Sum = 0
+for i in range(1,N+1):
+ for j in str(i):
+ if j == str(k):
+ Sum+=1
+print(Sum)
+
+
diff --git a/20240706.py b/20240706.py
new file mode 100644
index 0000000..8a9ebb1
--- /dev/null
+++ b/20240706.py
@@ -0,0 +1,18 @@
+t = int(input())
+b = []
+for i in range(t):
+ n = int(input())
+ a = input()
+ a = [int(j) for j in a.split()]
+ b.append(a)
+
+for i in range(t):
+ m = max(b[i])
+ for j in b[i]:
+ if m%j != 0:
+ break
+ else:
+ print("Yes")
+ continue
+ print("No")
+
diff --git a/20240706b.py b/20240706b.py
new file mode 100644
index 0000000..a3c28e3
--- /dev/null
+++ b/20240706b.py
@@ -0,0 +1,21 @@
+l1 = [6, 4, 2, 1, 5]#未排序
+for i in range(1,5):
+ print(i)
+#第一次循环 i=1 key=4 j=0
+#第二次循环 i=2 key=2 j=1
+for i in range(1,len(l1)):
+ key = l1[i]
+ j = i-1
+ # l1 [4,6,2,1,5]
+ while j>=0 and key