답안 #222768

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
222768 2020-04-14T01:42:39 Z errorgorn Popcount (COCI19_popcount) C++14
컴파일 오류
0 ms 0 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)+"))+((A>>"+str(2*mul)+")&"+str(temp)+")")

elif (n==3):
    ans.append("A=(((A&"+str(temp)+")+((A>>"+str(1*mul)+")&"+str(temp)+"))+((A>>"+str(2*mul)+")&"+str(temp)+"))+((A>>"+str(3*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])
    

Compilation message

popcount.cpp:1:1: error: 'import' does not name a type; did you mean 'short'?
 import math
 ^~~~~~
 short