이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
import math
n,k=map(int,input().split(" "))
ans=[]
mul=1
original_n=n
while (n>=5):
temp=0
for i in range(0,n,5):
temp|=(((1<<mul)-1)<<(i*mul))
temp&=(1<<original_n)-1
ans.append("A=(((((A&"+str(temp)+")+((A>>"+str(1*mul)+")&"+str(temp)+"))+((A>>"+str(2*mul)+")&"+str(temp)+"))+((A>>"+str(3*mul)+")&"+str(temp)+"))+((A>>"+str(4*mul)+")&"+str(temp)+"))")
mul*=5
n=math.ceil(n/5)
temp=0
for i in range(0,n,5):
temp|=(((1<<mul)-1)<<(i*mul))
temp&=(1<<original_n)-1
if (n==2):
ans.append("A=((A&"+str(temp)+")+((A>>"+str(1*mul)+")&"+str(temp)+"))")
elif (n==3):
ans.append("A=(((A&"+str(temp)+")+((A>>"+str(1*mul)+")&"+str(temp)+"))+((A>>"+str(2*mul)+")&"+str(temp)+"))")
elif (n==4):
ans.append("A=((((A&"+str(temp)+")+((A>>"+str(1*mul)+")&"+str(temp)+"))+((A>>"+str(2*mul)+")&"+str(temp)+"))+((A>>"+str(3*mul)+")&"+str(temp)+"))")
print(len(ans))
for i in range(len(ans)):
print(ans[i])
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |