답안 #222772

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
222772 2020-04-14T01:46:57 Z errorgorn Popcount (COCI19_popcount) Python 3
0 / 110
40 ms 3488 KB
import math
n,k=map(int,input().split(" "))
ans=[]
mul=1
while (n>=5):
    temp=0
    for i in range(0,n,5):
        temp|=(((1<<mul)-1)<<i)
    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)

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])
    
# 결과 실행 시간 메모리 Grader output
1 Correct 26 ms 3436 KB Accepted.
2 Correct 28 ms 3428 KB Accepted.
3 Correct 29 ms 3488 KB Accepted.
4 Correct 30 ms 3436 KB Accepted.
5 Correct 25 ms 3436 KB Accepted.
6 Correct 27 ms 3428 KB Accepted.
7 Correct 29 ms 3372 KB Accepted.
8 Correct 26 ms 3428 KB Accepted.
9 Incorrect 27 ms 3428 KB Wrong answer.
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 26 ms 3428 KB Wrong answer.
# 결과 실행 시간 메모리 Grader output
1 Correct 33 ms 3436 KB Accepted.
2 Correct 26 ms 3436 KB Accepted.
3 Correct 26 ms 3352 KB Accepted.
4 Correct 30 ms 3428 KB Accepted.
5 Correct 29 ms 3436 KB Accepted.
6 Correct 40 ms 3428 KB Accepted.
7 Incorrect 26 ms 3428 KB Wrong answer.
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 27 ms 3436 KB Wrong answer.
2 Halted 0 ms 0 KB -