当前位置:   article > 正文

第十五届蓝桥杯模拟赛第二期(Python版)_第十五届蓝桥stame23年python8月真题

第十五届蓝桥stame23年python8月真题

难得忙里偷闲,之前有些同学劝我更新第二期,但是确实有点忙,今天悄咪咪打开题目准备看看,没想到这次蓝桥杯模拟赛更水...........(我在群里看到一句话:本次蓝桥杯接近省赛水平,所以我好奇的进来了,没想到啊)

 第一题

  1. # 这个题我觉着口算就可以
  2. print(36 * 30 // 10)

答案是:108。

第二题

print(2 ** 2023 % 1000)

答案:608。

第三题

  1. cnt,n = 0,1
  2. while True:
  3. nn,mm = bin(n)[2:],oct(n)[2:]
  4. s1 = sum([int(i) for i in nn])
  5. s2 = sum([int(i) for i in mm])
  6. cnt += 1 if s1 == s2 else 0
  7. if cnt == 23:
  8. print(n)
  9. break
  10. n += 1

答案:4169。

第四题

  1. input_data = [
  2. [393353, 901440, 123481, 850930, 423154, 240461],
  3. [373746, 232926, 396677, 486579, 744860, 468782],
  4. [941389, 777714, 992588, 343292, 385198, 876426],
  5. [483857, 241899, 544851, 647930, 772403, 109929],
  6. [882745, 372491, 877710, 340000, 659788, 658675],
  7. [296521, 491295, 609764, 718967, 842000, 670302]
  8. ]
  9. max_data,max_num = 0,0
  10. data = [[0]*6 for _ in range(6)]
  11. def fun(num):
  12. cnt = 0
  13. for i in range(1, num+1):
  14. cnt += num % i == 0
  15. return cnt
  16. for i in range(6):
  17. data[i] = input_data[i]
  18. for i in range(6):
  19. for j in range(6):
  20. res = fun(data[i][j])
  21. if res > max_num:
  22. max_data = data[i][j]
  23. max_num = res
  24. print(max_data)

答案:901440。

第五题

  1. input_data = [
  2. "0000100010000001101010101001001100000011",
  3. "0101111001111101110111100000101010011111",
  4. "1000010000011101010110000000001011010100",
  5. "0110101010110000000101100100000101001001",
  6. "0000011010100000111111001101100010101001",
  7. "0110000110000000110100000000010010100011",
  8. "0100110010000110000000100010000101110000",
  9. "0010011010100110001111001101100110100010",
  10. "1111000111101000001110010001001011101101",
  11. "0011110100011000000001101001101110100001",
  12. "0000000101011000010011111001010011011100",
  13. "0000100000011001000100101000111011101100",
  14. "0010110000001000001010100011000010100011",
  15. "0110110000100011011010011010001101011011",
  16. "0000100100000001010000101100000000000010",
  17. "0011001000001000000010011001100101000110",
  18. "1110101000011000000100011001001100111010",
  19. "0000100100111000001101001000001010010001",
  20. "0100010010000110100001100000110111110101",
  21. "1000001001100010011001111101011001110001",
  22. "0000000010100101000000111100110010101101",
  23. "0010110101001100000100000010000010110011",
  24. "0000011101001001000111011000100111010100",
  25. "0010001100100000011000101011000000010101",
  26. "1001111010010110011010101110000000101110",
  27. "0110011101000010100001000101001001100010",
  28. "1101000000010010011001000100110010000101",
  29. "1001100010100010000100000101111111111100",
  30. "1001011010101100001000000011000110110000",
  31. "0011000100011000010111101000101110110001"
  32. ]
  33. def dfs(r, c):
  34. if r < 0 or r >= 30 or c < 0 or c >= 40: return
  35. if data[r][c] != 0:return
  36. data[r][c] = 2
  37. dfs(r - 1, c)
  38. dfs(r + 1, c)
  39. dfs(r, c - 1)
  40. dfs(r, c + 1)
  41. data = [[0]*40 for _ in range(30)]
  42. for i in range(30):
  43. data[i] = list(map(int, list(input_data[i].strip())))
  44. dfs(0, 0)
  45. cnt = 0
  46. for row in data:
  47. cnt += row.count(2)
  48. print(cnt)

答案:541。

思路就是直接dfs搜呗。

第六题

  1. string = input().strip()
  2. res = int(string[1:] + string[0])
  3. print(res)

第七题

  1. y = "aeiou"
  2. s = input().strip()[::-1]
  3. if any(i in y for i in s): print(next(i for i in s if i in y))

第八题

  1. n = int(input().strip())
  2. while n >= 10:
  3. s = str(n)
  4. res = 1
  5. for i in s:
  6. if i != "0":res *= int(i)
  7. print(res)
  8. n = res

第九题

可算有一道比之前好一丢丢的题了,不过还是s。

  1. def count_ac():
  2. n, m = map(int, input().split())
  3. grid = [list(map(int, input().strip().split())) for _ in range(n)]
  4. r, c = map(int, input().split())
  5. visited = [[False] * m for _ in range(n)]
  6. directions = [(0, 1), (0, -1), (1, 0), (-1, 0)]
  7. def gcd(a, b):
  8. while b:
  9. a, b = b, a % b
  10. return a
  11. def is_valid(x, y):
  12. return 0 <= x < n and 0 <= y < m
  13. def dfs(x, y):
  14. nonlocal count
  15. visited[x][y] = True
  16. count += 1
  17. current_value = grid[x][y]
  18. for dx, dy in directions:
  19. nx, ny = x + dx, y + dy
  20. if is_valid(nx, ny) and not visited[nx][ny]:
  21. next_value = grid[nx][ny]
  22. if gcd(current_value, next_value) > 1:
  23. dfs(nx, ny)
  24. count = 0
  25. dfs(r - 1, c - 1)
  26. print(count)
  27. count_ac()

 第十题

  1. n, k = map(int, input().strip().split())
  2. s = list(map(int, input().strip().split()))
  3. range_self = sum(s[:k])
  4. res = range_self
  5. for i in range(k, n):
  6. range_self += s[i] - s[i - k]
  7. res = max(range_self, res)
  8. print(res)

总结

糟糕透了,这......尤其是看见题目质量之后,还要更新这种文章。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/笔触狂放9/article/detail/504315
推荐阅读
相关标签
  

闽ICP备14008679号