绍兴市大学生程序设计竞赛
前言
现在暂时在台州学院oj上做题目
网址链接https://www.tzcoder.cn/acmhome/problemList.do?method=show
3275
C = int(input())
while C>0:
C = C-1
L,M,N= map(int, input().split())
print(M*N+L)
3277
t = int(input())
while t>0:
t = t-1
n = int(input())
cnt = 0
for i in range(n):
s = input()
if s=="Exchange":
cnt = cnt+1
else:
if(cnt%2==0): print("YES")
else : print("NO")
3278
# 预先计算并存储“快乐数”
# import time
happy_array = [False] * 5000001
happy_array[1] = True
res = [0] * 5000001
for i in range(505):
num_set = set()
temp=i
while True:
if temp in num_set:
break
num_set.add(temp)
sum = 0
for digit in str(temp):
sum += int(digit) ** 2
# 如果已经是快乐数了,就不用算了
if happy_array[sum] == True:
temp=1
break
temp =sum
if temp==1:
happy_array[i]=True
def findall(n):
sum = 0
for digit in str(n):
sum += int(digit) ** 2
if happy_array[sum] == True:
res[i] = res[i - 1] + 1
else:
res[i] = res[i - 1]
res[1]=1
for i in range(2,5000001):
findall(i)
t = int(input())
while t>0:
t = t-1
n = int(input())
print(res[n])
3280
切的时候按照2的倍数切,比如1,2,4,8,这样子就能表示1-\(2^{n+1}\)-1的范围,n为切的次数
t = int(input())
while t>0:
t = t-1
n = int(input())
if n==1:
print("0")
continue
i=0
while True:
if 2**i-1>=n:
print(i-1)
break
i=i+1
3752
while True:
n = int(input())
if n==0: break
num_str = str(n)
new_num= num_str[-1] + num_str[:-1]
if int(new_num)%n==0: print("Yes")
else:print("No")
3756
import math
def f(n):
res = 1
for i in range(2, int(math.sqrt(n)) + 1):
if n % i == 0:
if (i != int(n / i)):
res = res * i % 10007 * int(n / i) % 10007
else:
res = res * i % 10007
print(res)
t = int(input())
while t>0:
t = t-1
n = int(input())
f(n)
3758
while True:
try:
s= input()
res=0
for i in range(len(s)):
if s[i]>='a' and s[i]<='z':
res =res+ ord(s[i])-ord('a')+1
if s[i]>='A' and s[i]<='Z':
res = res + ord(s[i])-ord('A') + 1
print(res)
except EOFError:
break
7960
n, x = map(int, input().split())
nums = list(map(int, input().split()))
nums.sort()
for i in range(n):
if i+1>=n:
print(n)
break
if nums[i]+nums[i+1]>x:
print(i+1)
break
8380
n = int(input())
nums = list(map(int, input().split()))
max_val = max(nums)
min_val = min(nums)
for i in range(len(nums)):
if abs(nums[i]-max_val)>abs(nums[i]-min_val):
print(abs(nums[i]-max_val))
else:
print(abs(nums[i] - min_val))
8382
print("2023.11.19")
8385
import math
def find_set_faster(n):
if n < 10:
return None
max_z = int(math.log(n, 5))
max_y = int(math.log(n, 3))
max_x = int(math.log(n, 2))
for z in range(1,max_z+1):
for y in range(1,max_y+1):
for x in range(1,max_x+1):
if 2 ** x+3 ** y+5 ** z == n:
return x, y, z
return None
while True:
try:
n = int(input())
result = find_set_faster(n)
if result:
print(result[0],result[1],result[2])
else:
print(-1)
except EOFError:
break
8388
#dp[i]代表使用i个魔法点之后能达到最大的m个任务
dp = [float('inf')] * (55)
dp[0] = 1
dp[1] = 2
i=2
while True:
dp[i]= max(dp[i-1]*2,dp[i-2]*5)
if dp[i]>10 ** 18: break
i=i+1
def f(n):
i = 0
while True:
if dp[i] >= n:
print(i)
return
i = i + 1
t= int(input())
while t>0:
t=t-1
n = int(input())
f(n)