Signed-off-by: 10_2 <sairate@sina.cn>

This commit is contained in:
10_2 2024-07-13 10:49:07 +08:00
commit 8c25746b0b
31 changed files with 421 additions and 0 deletions

3
.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
# 默认忽略的文件
/shelf/
/workspace.xml

1
.idea/.name Normal file
View File

@ -0,0 +1 @@
2024-7-9-1.py

View File

@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</state>
</component>

View File

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

4
.idea/misc.xml Normal file
View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10" project-jdk-type="Python SDK" />
</project>

8
.idea/modules.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/刘天硕.iml" filepath="$PROJECT_DIR$/.idea/刘天硕.iml" />
</modules>
</component>
</project>

8
.idea/刘天硕.iml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

20
2024-5-31-1.py Normal file
View File

@ -0,0 +1,20 @@
a_set={'1','1','1'}
print(a_set)
b_set={'l','t','s'}
print(b_set)
c='I love python'
d=set(c)
print(d)
c=('4','5','6','7','8','9')
d=set(c)
print(d)
r={1,2,3,4,5,6}
print(len(r))
'''
set:集合
frozen:冰冻
frozenset:不可变集合
'''

10
2024-6-14-1.py Normal file
View File

@ -0,0 +1,10 @@
def pan(a,b,c):
if a+b>c and b+c>a and a+c>b:
print()
else:
print()
q=int(input())
w=int(input())
e=int(input())
pan(a,b,c)

7
2024-6-14-2.py Normal file
View File

@ -0,0 +1,7 @@
a=int(input())
b=0
for i in range(2,a):
if a%i==0:
b=i
break
print(int(a/b))

27
2024-6-16-1.py Normal file
View File

@ -0,0 +1,27 @@
a=int(input())
s=0
d=1
e=0
if a%2==0:
e=int(a/2)
else:
e=int(a/2+0.5)
for i in range(1,e+1):
if i%2==0:
s-=1/d
else:
s+=1/d
d+=2
print(round(s,8))
count=1
sum=0
for i in range(1,a+1,2):
if count%2:
sum+=1/i
else:
sum-=1/i
count+=1
print(round(sum,8))

13
2024-6-2-1.py Normal file
View File

@ -0,0 +1,13 @@
k=int(input())
l=int(input())
r=int(input())
s=0
for i in range(l,r+1):
if i%10==k:
s+=i
elif i%k==0:
s+=i
print(s)

6
2024-6-2-2.py Normal file
View File

@ -0,0 +1,6 @@
xingrun=int(input())
guli=int(input())
if xingrun>=10 or guli>=20:
print(1)
else:
print(0)

12
2024-6-2-3.py Normal file
View File

@ -0,0 +1,12 @@
yu=int(input())
shu=int(input())
ying=int(input())
if yu<60 and shu>=60 and ying>=60:
print(1)
elif yu>=60 and shu<60 and ying>=60:
print(1)
elif yu>=60 and shu>=60 and ying<60:
print(1)
else:
print(0)

6
2024-6-2-4.py Normal file
View File

@ -0,0 +1,6 @@
start_h=int(input())
start_m=int(input())
end_h=int(input())
end_m=int(input())
print((end_h*60+end_m)-(start_h*60+start_m))

7
2024-6-2-5.py Normal file
View File

@ -0,0 +1,7 @@
num=int(input())
anser=0
for i in range(1,num+1):
anser+=i*num
num-=1
print(anser)

3
2024-6-20-1.py Normal file
View File

@ -0,0 +1,3 @@
a=int(input())
print(a//13)
print(a%13)

6
2024-6-20-2.py Normal file
View File

@ -0,0 +1,6 @@
n=int(input())
for i in range(1,n+1):
if n%i==0:
print(i)

4
2024-6-23-1.py Normal file
View File

@ -0,0 +1,4 @@
import turtle
turtle.circle(150,steps=4)
turtle.done()

11
2024-6-23-2.py Normal file
View File

@ -0,0 +1,11 @@
a=int(input())
b=int(input())
if b==2:
if a%4==0 and a%100!=0 or a%400==0:
print(29)
else:
print(28)
elif b==1 or 3 or 5 or 7 or 8 or 10 or 12:
print(31)
else:
print(30)

8
2024-6-23-3.py Normal file
View File

@ -0,0 +1,8 @@
a=int(input())
b=int(input())
c=int(input())
d=input()
if d=="a":
print(a*60*60+b*60+c)
elif d=="p":
print(12*60*60+a * 60 * 60 + b * 60 + c)

11
2024-6-28-1.py Normal file
View File

@ -0,0 +1,11 @@
a=int(input())
b=65
for i in range(1,a+1):
for p in range(1,i+1):
print(chr(b),end=" ")
b+=1
if b>90:
b=65
print("")

20
2024-6-7-1.py Normal file
View File

@ -0,0 +1,20 @@
a={"h","j","e"}
a.add("e")
print(a)
"""
intersection:相交
differece:差别
union:同盟联合并集
symmetric_differece():表示对称差集
disjoint:不相交的
subset:子集分组
superset:父集超集
"""
a=int(input())
s=0
for i in range(1,a+1):
s+=i
print(s)

37
2024-7-10-1.py Normal file
View File

@ -0,0 +1,37 @@
#(lambda 形参,形参:表达式)(实参,实参) lambda函数
print((lambda x,y=3:x*y)(8))
def fun(x):
if x%2:
return None
else:
return x
x=int(input())
print(fun(x))
#filter(形参,[实参,实参,实参,实参'实参']) filter函数
print(list(filter(None,[0,1,2,3,4,5,6,7,8,9,10,""," ","",False,[],()])))
print(tuple(filter(None,[0,1,2,3,4,5,6,7,8,9,10,""," ","",False,[],()])))
def f(u):
print("Hello,Python!")
if u%2==0:
return True
else:
return False
print(list(filter(f,[0,12,2,37,56,43,53,77,90])))
#1-100奇数求和
a=0
for i in range(1,101,2):
a+=i
print(a)
print(sum(list(range(1,101,2))))
#sorted默认为升序排序
print(sorted([2,65,321,124]))
#高于5000的工资
salaries={"Jack":3000,"Alex":6000,"Dannle":4000,"Anne":10000,"Charlie":5100}
print(list(filter(lambda k:salaries[k]>5000,salaries)))

84
2024-7-10-2.py Normal file
View File

@ -0,0 +1,84 @@
b=int(input())
c=int(input())
import turtle
t=turtle.Turtle()
a=turtle.Turtle()
t.speed(0)
a.speed(0)
t.left(90)
t.pensize(5)
a.pensize(5)
t.goto(0,0)
a.penup()
a.goto(200,0)
a.pendown()
d=0
e=0
f=0
g=0
while 1:
for i in range(10):
for i in range(b):#for循环结构,range()函数迭代器list,tuple...
t.pencolor(e,f,g)
t.forward(c)
t.left(360/b)
a.pencolor(e,f,g)
a.forward(c)
a.left(360/b)
for i in range(b):#for循环结构,range()函数迭代器list,tuple...
t.pencolor("white")
t.forward(c)
t.left(360/b)
a.pencolor("white")
a.forward(c)
a.left(360/b)
d=d+1
e=d/10
if e>0.9:
e=0
d=0
f=f+0.1
if f>0.9:
f=0.1
g=g+0.1
if g>0.9:
g=0
a.backward(20)
for i in range(2):
for i in range(b):#for循环结构,range()函数迭代器list,tuple...
t.pencolor(e,f,g)
t.forward(c)
t.left(360/b)
a.pencolor(e,f,g)
a.forward(c)
a.left(360/b)
for i in range(b):#for循环结构,range()函数迭代器list,tuple...
t.pencolor("white")
t.forward(c)
t.left(360/b)
a.pencolor("white")
a.forward(c)
a.left(360/b)
t.forward(c)
for i in range(10):
for i in range(b):#for循环结构,range()函数迭代器list,tuple...
t.pencolor(e,f,g)
t.forward(c)
t.left(360/b)
a.pencolor(e,f,g)
a.forward(c)
a.left(360/b)
for i in range(b):#for循环结构,range()函数迭代器list,tuple...
t.pencolor("white")
t.forward(c)
t.left(360/b)
a.pencolor("white")
a.forward(c)
a.left(360/b)
a.backward(20)
t.goto(0,0)
a.penup()
a.goto(200,0)
a.pendown()
turtle.down()

10
2024-7-11-1.py Normal file
View File

@ -0,0 +1,10 @@
#map(函数,不定长迭代器) map函数
#题目要求:已知列表[1,2,3,4,5,6,7,8,9],请你返回一个x*x的列表.
li=[1,2,3,4,5,6,7,8,9]
print(list(map(lambda x:x*x,li)))
#导入functools,才可使用reduce函数
#functools.reduce(函数对象,序列,初始数据)
import functools
list1=["a","b","c","Python"]
print(functools.reduce(lambda a,b:a+b,list1,"Hello"))

20
2024-7-11-2.py Normal file
View File

@ -0,0 +1,20 @@
list=[]
list1=[]
u=int(input())
for i in range(u):
list.append(int(input()))
for i in list:
a=i
b=0
num=a
while a!=0:
list1.append(a%10)
a=a//10
b+=1
q=0
for t in list1:
q+=t**b
if q==num:
print("T")
else:
print("F")

9
2024-7-12-1.py Normal file
View File

@ -0,0 +1,9 @@
a=int(input())
b=int(input())
c=int(input())
d=min(min(a,b),c)
for i in range(d,0,-1):
if a%i==0 and b%i==0 and c%i==0:
print(i)
break

14
2024-7-9-1.py Normal file
View File

@ -0,0 +1,14 @@
list=[]
n=int(input())
for i in range(n):
list.append(int(input()))
for i in list:
num=i
result=0
for x in range(1,int((num/2)**0.5)+1):
if num-x**2==(int((num-x**2)**0.5))**2:
print("YES")
result=1
break
if result==0:
print("NO")

13
B2077 角谷猜想.py Normal file
View File

@ -0,0 +1,13 @@
def jiaogu(n):
if n==1:
print("End")
return 1
if n%2==0:
print(n,"/",2,"=",n//2,sep="")
jiaogu(n//2)
else:
print(n, "*", 3, "+",1,"=" ,n * 3+1, sep="")
jiaogu(n*3+1)
n=int(input())
jiaogu(n)

View File

@ -0,0 +1,28 @@
#自幂数判断函数
def is_zimi(x):
weishu=[]
count=0
num=x
#拆位求解
while x!=0:
weishu.append(x%10)
x=x//10
count+=1
#位数求和
sum=0
for i in weishu:
sum+=pow(i,count)
#自幂数判断
if sum==num:
return "T"
else:
return "F"
#输入多个数字
numbers=[]
n=int(input())
for i in range(n):
numbers.append(int(input()))
#循环判断是否是自幂数
for i in numbers:
print(is_zimi(i))