概述
写在前面
- 本篇题解涵盖范围为1 - 8 题,最后两题本人没能解出来
- 使用语言为Python
- 过样例 不确定能否AC
- 仅供参考 若有错误 欢迎指出
- 最后两题若有佬会 可以评论给出你的思路 感激不尽 ????
# 直接调用转二进制函数即可
# 具体用法请查官方文档
s = 2022
ans = bin(s)
print(len(ans[2:]))
调用datetime函数,枚举每一天并判断是否符合要求
import datetime
start = datetime.date(2022,1,1)
ans = 0
diff = datetime.timedelta(1)
end = datetime.date(2022,12,31)
def check(date) :
if datetime.date.weekday(date) == 5 or datetime.date.weekday(date) == 6 :
return True
date = str(date)
if date[-2:] == '01' or date[-2:] == '11' or date[-2:] == '21' or date[-2:] == '31' :
return True
return False
while start <= end :
if check(start) : ans += 1
start += diff
print(ans)
简单模拟,大于12时输出答案
idx = 1
target = 12
tot = 0
ans = 0
while tot < target :
tot += 1 / idx
ans += 1
idx += 1
print(ans)
遍历每个点,判断是否为山谷即可
s = "PHQGHUMEAYLNLFDXFIRCVSCXGGBWKFNQDUXWFNFOZVSRTKJPREPGGXRPNRVY
STMWCYSYYCQPEVIKEFFMZNIMKKASVWSRENZKYCXFXTLSGYPSFADPOOEFXZBC
OEJUVPVABOYGPOEYLFPBNPLJVRVIPYAMYEHWQNQRQPMXUJJLOOVAOWUXWHMS
NCBXCOKSFZKVATXDKNLYJYHFIXJSWNKKUFNUXXZRZBMNMGQOOKETLYHNKOAU
GZQRCDDIUTEIOJWAYYZPVSCMPSAJLFVGUBFAAOVLZYLNTRKDCPWSRTESJWHD
IZCOBZCNFWLQIJTVDWVXHRCBLDVGYLWGBUSBMBORXTLHCSMPXOHGMGNKEUFD
XOTOGBGXPEYANFETCUKEPZSHKLJUGGGEKJDQZJENPEVQGXIEPJSRDZJAZUJL
LCHHBFQMKIMWZOBIWYBXDUUNFSKSRSRTEKMQDCYZJEEUHMSRQCOZIJIPFION
EEDDPSZRNAVYMMTATBDZQSOEMUVNPPPSUACBAZUXMHECTHLEGRPUNKDMBPPW
EQTGJOPARM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RFUSEWJTBOXVYNFHKSTCENAUMNDD
XFDMVZCAUTDCCKXAAYDZSXTTOBBGQNGVVPJGOJOGLMKXGBFCPYPCKQCHBDDZ
WRXBZMQRLXVOBTWHXGINFGFRCCLMZNMJUGWWBSQFCIHUBSJOLLMSQSGHMCPH
ELSOTFLBGSFNPCUZSRUPCHYNVZHCPQUGRIWNIQXDFJPWPXFBLKPNPEELFJMT"
Map = [[0] * 60 for i in range(30)]
for i in range(30) :
for j in range(60) :
Map[i][j] = s[i*30+j]
def check(x,y) :
for i,j in [(1,0),(0,1),(0,-1),(-1,0)] :
px = x + i ; py = y + j
if ord(Map[x][y]) >= ord(Map[px][py]) : return False
return True
# for i in range(3) :
# for j in range(5) :
# print(Map[i][j],end=' ')
# print()
ans = 0
for i in range(30) :
for j in range(60) :
if i == 0 or j == 0 or i == 29 or j == 59 : continue
if check(i,j) : ans += 1
print(ans)
二位前缀和,枚举起点和终点的横坐标和列坐标即可
Map = [[0] * 101 for i in range(101)]
Map[1][1] = 1
for i in range(1,101) :
for j in range(1,101) :
if i == 1 and j == 1 : continue
if j == 1 : Map[i][j] = Map[i-1][j] + 1
else : Map[i][j] = Map[i][j-1] + 2
for i in range(1,101) :
for j in range(1,101) :
Map[i][j] += Map[i-1][j] + Map[i][j-1] - Map[i-1][j-1]
print(Map[3][3])
ans = float('inf')
for i in range(1,101) :
for j in range(i,101) :
for k in range(1,101) :
for t in range(k,101) :
if Map[j][t] - Map[j][k-1] - Map[i-1][t] + Map[i-1][k-1] == 2022 :
ans = min(ans,(j-i+1)*(t-k+1))
print(ans)
模拟 , 签到题
s = int(input())
t = int(input())
ans = 0
if t > s : print(t - s)
else : print(t + 7 - s)
直接调用replace函数
s = input()
s = s.replace('a', 'A')
s = s.replace('e', 'E')
s = s.replace('i', 'I')
s = s.replace('o', 'O')
s = s.replace('u', 'U')
print(s)
按照输入的顺序,当前的时间-上一个时间✖️电流✖️电压,计算总和
n = int(input())
ans = 0
for i in range(n) :
s,U,I = input().split()
H,M,S = s.split(':')
if i == 0 :
oldU = int(U) ; oldI = int(I)
oldH = int(H) ; oldM = int(M) ; oldS = int(S)
else :
ans += ((int(H) - oldH) * 3600 + (int(M) - oldM) * 60 + (int(S) - oldS)) * oldU * oldI
oldU = int(U) ; oldI = int(I)
oldH = int(H) ; oldM = int(M) ; oldS = int(S)
print(ans)
# 没有思路
# 没有思路
最后
以上就是优雅宝贝为你收集整理的第十四届蓝桥杯模拟赛(Python)的全部内容,希望文章能够帮你解决第十四届蓝桥杯模拟赛(Python)所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复