难得忙里偷闲,之前有些同学劝我更新第二期,但是确实有点忙,今天悄咪咪打开题目准备看看,没想到这次蓝桥杯模拟赛更水...........(我在群里看到一句话:本次蓝桥杯接近省赛水平,所以我好奇的进来了,没想到啊)
# 这个题我觉着口算就可以
print(36 * 30 // 10)
答案是:108。
print(2 ** 2023 % 1000)
答案:608。
cnt,n = 0,1
while True:
nn,mm = bin(n)[2:],oct(n)[2:]
s1 = sum([int(i) for i in nn])
s2 = sum([int(i) for i in mm])
cnt += 1 if s1 == s2 else 0
if cnt == 23:
print(n)
break
n += 1
答案:4169。
input_data = [
[393353, 901440, 123481, 850930, 423154, 240461],
[373746, 232926, 396677, 486579, 744860, 468782],
[941389, 777714, 992588, 343292, 385198, 876426],
[483857, 241899, 544851, 647930, 772403, 109929],
[882745, 372491, 877710, 340000, 659788, 658675],
[296521, 491295, 609764, 718967, 842000, 670302]
]
max_data,max_num = 0,0
data = [[0]*6 for _ in range(6)]
def fun(num):
cnt = 0
for i in range(1, num+1):
cnt += num % i == 0
return cnt
for i in range(6):
data[i] = input_data[i]
for i in range(6):
for j in range(6):
res = fun(data[i][j])
if res > max_num:
max_data = data[i][j]
max_num = res
print(max_data)
答案:901440。
input_data = [
"0000100010000001101010101001001100000011",
"0101111001111101110111100000101010011111",
"1000010000011101010110000000001011010100",
"0110101010110000000101100100000101001001",
"0000011010100000111111001101100010101001",
"0110000110000000110100000000010010100011",
"0100110010000110000000100010000101110000",
"0010011010100110001111001101100110100010",
"1111000111101000001110010001001011101101",
"0011110100011000000001101001101110100001",
"0000000101011000010011111001010011011100",
"0000100000011001000100101000111011101100",
"0010110000001000001010100011000010100011",
"0110110000100011011010011010001101011011",
"0000100100000001010000101100000000000010",
"0011001000001000000010011001100101000110",
"1110101000011000000100011001001100111010",
"0000100100111000001101001000001010010001",
"0100010010000110100001100000110111110101",
"1000001001100010011001111101011001110001",
"0000000010100101000000111100110010101101",
"0010110101001100000100000010000010110011",
"0000011101001001000111011000100111010100",
"0010001100100000011000101011000000010101",
"1001111010010110011010101110000000101110",
"0110011101000010100001000101001001100010",
"1101000000010010011001000100110010000101",
"1001100010100010000100000101111111111100",
"1001011010101100001000000011000110110000",
"0011000100011000010111101000101110110001"
]
def dfs(r, c):
if r < 0 or r >= 30 or c < 0 or c >= 40: return
if data[r][c] != 0:return
data[r][c] = 2
dfs(r - 1, c)
dfs(r + 1, c)
dfs(r, c - 1)
dfs(r, c + 1)
data = [[0]*40 for _ in range(30)]
for i in range(30):
data[i] = list(map(int, list(input_data[i].strip())))
dfs(0, 0)
cnt = 0
for row in data:
cnt += row.count(2)
print(cnt)
答案:541。
思路就是直接dfs搜呗。
string = input().strip()
res = int(string[1:] + string[0])
print(res)
y = "aeiou"
s = input().strip()[::-1]
if any(i in y for i in s): print(next(i for i in s if i in y))
n = int(input().strip())
while n >= 10:
s = str(n)
res = 1
for i in s:
if i != "0":res *= int(i)
print(res)
n = res
可算有一道比之前好一丢丢的题了,不过还是s。
def count_ac():
n, m = map(int, input().split())
grid = [list(map(int, input().strip().split())) for _ in range(n)]
r, c = map(int, input().split())
visited = [[False] * m for _ in range(n)]
directions = [(0, 1), (0, -1), (1, 0), (-1, 0)]
def gcd(a, b):
while b:
a, b = b, a % b
return a
def is_valid(x, y):
return 0 <= x < n and 0 <= y < m
def dfs(x, y):
nonlocal count
visited[x][y] = True
count += 1
current_value = grid[x][y]
for dx, dy in directions:
nx, ny = x + dx, y + dy
if is_valid(nx, ny) and not visited[nx][ny]:
next_value = grid[nx][ny]
if gcd(current_value, next_value) > 1:
dfs(nx, ny)
count = 0
dfs(r - 1, c - 1)
print(count)
count_ac()
n, k = map(int, input().strip().split())
s = list(map(int, input().strip().split()))
range_self = sum(s[:k])
res = range_self
for i in range(k, n):
range_self += s[i] - s[i - k]
res = max(range_self, res)
print(res)
糟糕透了,这......尤其是看见题目质量之后,还要更新这种文章。