测试题目的输入模板喵☝🤓
测试题目的输入模板
这里是测试题目的输入模板,即读入已经写好,你只需要在函数中填充解法即可
如果你觉得有需要,可以修改输入的方式。
一切随你喵,只要过了就行。
注意:输出需要你自己写,大部分不是很难喵~
目录
- 测试题目的输入模板
- 目录
- 你可能会用到的代码
- A - 看看你会不会用电脑
- B - 求求你不要用内置函数
- C - GPA
- D - min
- E - for循环大神
- F - 居然有人说这个是线性代数
- G - 高三同学秒了
- H - 无穷级数
- I - 不要用内置函数😭
- J - 古人的wisdom
- K - 经常算组合数的同学都知道
- L - minmax
- M - 传奇读题大赛
- N - 博弈
- O - EZ?
- P - 你会不会暴力
- Q - 一点点🤏hard
- R - 比较真的真题
- S - 没什么难的
- T - 不准使用四重for循环!
- U - 漆黑的白
- V - 培训
- W - ABABA
- X - 来听讲座的在这里签到
- Y - 拓展题01:分类讨论
- Z - 超级无敌逆天传奇模拟题
你可能会用到的代码
# 快速幂算法,在O(logN)时间复杂度内求 a^b % p的值
def fastpower(a: int, b: int, p: int) -> int:
res = 1
a %= p
while b > 0:
if b % 2 == 1:
res = res * a % p
a = a * a % p
b //= 2
return res
#------------
# 求a和b的最大公约数,O(logN)时间复杂度
def gcd(a: int, b: int) -> int:
if b == 0:
return a
return gcd(b, a % b)
#------------
# 求a和b的最小公倍数
def lcm(a: int, b: int) -> int:
return a * b // gcd(a, b)
#------------
A - 看看你会不会用电脑
https://vjudge.net/contest/666068#problem/A
a, b = map(int, input().split())
def sol(a: int, b: int):
# do sth
pass
sol(a, b)
B - 求求你不要用内置函数
https://vjudge.net/contest/666068#problem/B
num:str = input()
def sol(num: str):
# do sth
pass
sol(num)
C - GPA
https://vjudge.net/contest/666068#problem/C
a, b, c = map(int, input().split())
def sol(a: int, b: int, c: int):
# do sth
pass
sol(a, b, c)
D - min
https://vjudge.net/contest/666068#problem/D
n = int(input())
lst = list(map(int, input().split()))
def sol(n: int, lst: list):
# do sth
pass
sol(n, lst)
E - for循环大神
https://vjudge.net/contest/666068#problem/E
n:int = int(input())
def sol(n: int):
# do sth
pass
sol(n)
F - 居然有人说这个是线性代数
https://vjudge.net/contest/666068#problem/F
n:int = int(input())
def sol(n: int):
# do sth
pass
sol(n)
G - 高三同学秒了
https://vjudge.net/contest/666068#problem/G
n:int = int(input())
def sol(n: int):
# do sth
pass
sol(n)
H - 无穷级数
https://vjudge.net/contest/666068#problem/H
k:int = int(input())
def sol(k: int):
# do sth
pass
sol(k)
I - 不要用内置函数😭
https://vjudge.net/contest/666068#problem/I
n:int = int(input())
def sol(n: int):
# do sth
pass
sol(n)
J - 古人的wisdom
https://vjudge.net/contest/666068#problem/J
n:int = int(input())
def sol(n: int):
# do sth
pass
sol(n)
K - 经常算组合数的同学都知道
https://vjudge.net/contest/666068#problem/K
# input
t: int = int(input())
list_n = list(map(int, input().split()))
list_k = list(map(int, input().split()))
p = 1000000007 # (10^9 + 7) 模数
#-----------------
def sol(t: int, list_n: list, list_k: list) -> int:
# do sth
pass
#-----------------
# output
sol(t, list_n, list_k)
L - minmax
https://vjudge.net/contest/666068#problem/L
t: int = int(input())
def sol(n: int,lst: list):
# do sth
pass
while t:
n = int(input())
lst = list(map(int, input().split()))
sol(n, lst)
t -= 1
M - 传奇读题大赛
https://vjudge.net/contest/666068#problem/M
t: int = int(input())
def sol(n: int):
# do sth
pass
while t:
n = int(input())
sol(n)
t -= 1
N - 博弈
https://vjudge.net/contest/666068#problem/N
t: int = int(input())
def sol(n: int,s:str):
# do sth
pass
while t:
n = int(input())
s= input()
sol(n,s)
t -= 1
O - EZ?
https://vjudge.net/contest/666068#problem/O
t= int(input())
def sol(a:str,b:str):
# do sth
pass
while t:
a, b = input().split()
sol(a, b)
t -= 1
P - 你会不会暴力
https://vjudge.net/contest/666068#problem/P
t: int = int(input())
def sol(n: int):
# do sth
pass
while t:
n = int(input())
sol(n)
t -= 1
Q - 一点点🤏hard
https://vjudge.net/contest/666068#problem/Q
t: int = int(input())
def sol(n: int, lst: list):
# do sth
pass
while t:
n = int(input())
lst = list(map(int, input().split()))
sol(n, lst)
t -= 1
R - 比较真的真题
https://vjudge.net/contest/666068#problem/R
t: int = int(input())
# mp是list,里面的元素是str喵
def sol(n: int, m: int, mp: list):
# do sth
pass
while t:
n, m = map(int, input().split())
mp = []
for i in range(n):
tmp: str = input()
mp.append(tmp)
sol(n, m, mp)
t -= 1
S - 没什么难的
https://vjudge.net/contest/666068#problem/S
n: int = int(input())
lst_a = list(map(int, input().split()))
lst_b = list(map(int, input().split()))
def sol(n: int, lst_a: list, lst_b: list):
# do sth
pass
sol(n, lst_a, lst_b)
T - 不准使用四重for循环!
n: int = int(input())
lst_n = list(map(int, input().split()))
m: int = int(input())
lst_m = list(map(int, input().split()))
l: int = int(input())
lst_l = list(map(int, input().split()))
q: int = int(input())
lst_q = list(map(int, input().split()))
def sol(n, m, l, q, lst_n, lst_m, lst_l, lst_q):
#do sth
pass
sol(n, m, l, q, lst_n, lst_m, lst_l, lst_q)
U - 漆黑的白
https://vjudge.net/contest/666068#problem/U
t: int = int(input())
def sol(n:int, wall:str):
# do sth
pass
while t:
n = int(input())
wall = input()
sol(n, wall)
t -= 1
V - 培训
https://vjudge.net/contest/666068#problem/V
t:int = int(input())
def sol(name:str, age:int, grade: int):
while t:
name, age, grade = input().split()
age = int(age)
grade = int(grade)
sol(name, age, grade)
t -= 1
W - ABABA
https://vjudge.net/contest/666068#problem/W
t: int = int(input())
def sol(s:str):
# do sth
pass
while t:
s = input()
sol(s)
t -= 1
X - 来听讲座的在这里签到
https://vjudge.net/contest/666068#problem/X
t: int = int(input())
def sol(a:int, b: int):
# do sth
pass
while t:
a, b = map(int, input().split())
sol(a, b)
t -= 1
Y - 拓展题01:分类讨论
https://vjudge.net/contest/666068#problem/Y
n: int = int(input())
lst = list(map(int, input().split()))
def sol(n: int, lst: list):
# do sth
pass
sol(n, lst)
Z - 超级无敌逆天传奇模拟题
https://vjudge.net/contest/666068#problem/Z
t: int = int(input())
def sol(line: int, complexity: str, code: list):
# do sth
pass
while t:
line, complexity = input().split()
line = int(line)
code: list = []
for i in range(line):
code.append(input())
sol(line, complexity, code)
t -= 1