<> The law of violence is good !!!

* All the questions answered here , Not verified , For ideas only （~）
<>A Seeking remainder

* Don't write code , Oral arithmetic ,ans=1
<>B Double factorial

sum1 = 1 cnt = 1 while(cnt<=3): sum1= (sum1 * cnt)%100000 cnt+=2 print(sum1)
<>C Lattice point

nums = 0 for i in range(1,2022): for j in range(1,2022): if i*j <= 2021: nums+=
1 print(nums)
<>D Integer Decomposition

* This question , Pure violence , Not so much to get the answer , Start with python Written code , The speed is too slow , Because it is a blank filling question , I use it in the back C Run out answer ( Time is not short ) #include
<stdio.h> int main(){ int nums=0; int i1,i2,i3,i4,i5; for(i1=1;i1<2021;i1++){
for(i2=1;i2<2021-i1;i2++){ for(i3=1;i3<2021-i1-i2;i3++){ for(i4=1;i4<2021-i1-i2-
i3;i4++){ if((2021-i1-i2-i3-i4)>=1){ nums++; } } } } } printf("%d",nums); return
0; }
<>E city-state

def func(i,j): strs1 = str(i) strs2 = str(j) len1 = len(strs1) len2 = len(strs2
) sum1 = 0 if len1==len2: for i in range(1,len1+1): cnt = -1*i if strs1[cnt]!=
strs2[cnt]: sum1+=int(strs1[cnt])+int(strs2[cnt]) elif len1>len2: for i in range
(1,len2+1): cnt = -1*i if strs1[cnt]!=strs2[cnt]: sum1+=int(strs1[cnt])+int(
strs2[cnt]) for i in range(len2+1,len1+1): cnt = -1*i sum1+=int(strs1[cnt]) elif
len1<len2: for i in range(1,len1+1): cnt = -1*i if strs1[cnt]!=strs2[cnt]: sum1
+=int(strs1[cnt])+int(strs2[cnt]) for i in range(len1+1,len2+1): cnt = -1*i sum1
+=int(strs2[cnt]) return sum1 print(func(2021,922)) ans = 0 # Traversal between bridges for i in
range(1,2021): for j in range(i+1,2021): ans+=func(i,j) print(ans)
<>F Small square

n = int(input()) n_ban = 1.0*n / 2 ans = 0 for i in range(1,n): cnt = (i**2) %
nif (1.0*cnt)<n_ban: ans+=1 print("{:.0f}".format(ans))
<>G Complete square

import math # Judge whether a number is a complete square number def func(num): flag = 0 for i in range(int(math.
sqrt(num))+1): if i*i == num: flag = 1 break if i*i >num: break if flag == 1:
return True else: return False n = int(input()) ans = 0 for x in range(1,n+1):
if func(n*x): ans = x break print("{:.0f}".format(ans))

* thinking ： Point in time order , To simulate the flow of the operating system """ 2( Number of computers ) 6( Number of tasks ) 5 5 ( Computer computing ability ) ai( time ) bi( Computer number )
ci( second ) di( Computational power ) 2 6 5 5 1 1 5 3 2 2 2 6 3 1 2 3 4 1 6 1 5 1 3 3 6 1 3 4 #D
187539689 """ # Slightly complicated , Go first class PC: def __init__(self,id,xingneng): self.id = id
# performance self.xingneng = xingneng # Occupied by task task id # self.thing_id = [] # Occupied performance self.
useing_xingneng= [] # Time remaining for each task self.shengyv_time = [] # Remaining performance of the computer self.
shengyv_xingneng= xingneng # Number of tasks left on the computer self.shengyv_renwu = 0 com_nums,
thing_nums= map(int,input().split()) com_ablity = [int(i) for i in input().split
()] things = [] for _ in range(thing_nums): temp = [int(i) for i in input().
split()] things.append(temp) # initialization PC PCS = [] for i in range(com_nums): pc = PC(
i+1,com_ablity[i]) PCS.append(pc) now_time = 0 thing_flag = 0 while(thing_flag<
thing_nums): # At this second , Completion of all computers for i in range(com_nums): pc = PCS[i] if pc.
shengyv_renwu!= 0: for j in range(len(pc.shengyv_time)): pc.shengyv_time[j]-=1
if pc.shengyv_time[j]==0: pc.shengyv_xingneng += pc.useing_xingneng[j] pc.
useing_xingneng[j]=0 pc.shengyv_renwu-=1 # eliminate 0 pc.useing_xingneng = [i for i in
pc.useing_xingneng if i!=0] pc.shengyv_time = [i for i in pc.shengyv_time if i
!=0] if now_time == things[thing_flag][0]: bi,ci,di = things[thing_flag][1],
things[thing_flag][2],things[thing_flag][3] thing_flag+=1 if di<=PCS[bi-1].
shengyv_xingneng: PCS[bi-1].useing_xingneng.append(di) PCS[bi-1].shengyv_time.
append(ci) PCS[bi-1].shengyv_xingneng-=di PCS[bi-1].shengyv_renwu+=1 print(
"{:.0f}".format(PCS[bi-1].shengyv_xingneng)) else: print("-1") now_time+=1
<>I Chess

* thinking ： This question , I didn't expect a good algorithm at that time , I use recursive implementation （ Can't get full marks , Will timeout , If there is a good algorithm , Welcome to leave a message ） # Judge whether the two coordinates attack each other def func(
p1,p2): flag = 0 if (p1[0]+1)==p2[0] and (p1[1]+2)==p2[1]: flag = 1 elif (p1[0]+
1)==p2[0] and (p1[1]-2)==p2[1]: flag = 1 elif (p1[0]-1)==p2[0] and (p1[1]+2)==p2
[1]: flag = 1 elif (p1[0]-1)==p2[0] and (p1[1]-2)==p2[1]: flag = 1 elif (p1[0]+2
)==p2[0] and (p1[1]+1)==p2[1]: flag = 1 elif (p1[0]+2)==p2[0] and (p1[1]-1)==p2[
1]: flag = 1 elif (p1[0]-2)==p2[0] and (p1[1]+1)==p2[1]: flag = 1 elif (p1[0]-2)
==p2[0] and (p1[1]-1)==p2[1]: flag = 1 if flag == 1: return True else: return
False # Judgment coordinates Does it conflict with the previous coordinates def zb_and_zbs(zb,zbs): if len(zbs)==0: return False
else: flag = 0 for zb2 in zbs: if func(zb,zb2): flag = 1 break if flag == 1:
return True else: return False # recursion def dg(zbs,all_zb,K,i): global ans if len(
zbs)==K: #print(zbs) ans= (ans+1)%1000000007 elif len(zbs)<K: for j in range(i,
len(all_zb)): one_zb = all_zb[j] zbs1 = zbs[:] if (one_zb not in zbs) and (not
zb_and_zbs(one_zb,zbs)): zbs1.append(one_zb) dg(zbs1,all_zb,K,j+1) n,m,K = map(
int,input().split()) # Build all coordinates all_zb = [] for i in range(n): for j in range(m):
all_zb.append([i,j]) # Write recursion zbs = [] global ans ans = 0 for i in range(len(
all_zb)): zbs = [all_zb[i]] dg(zbs,all_zb,K,i+1) print(ans)
<>J

* can't , Cheat points ~, Hee hee

Technology
Daily Recommendation
views 1