Submission #222817

#TimeUsernameProblemLanguageResultExecution timeMemory
222817dantoh000Popcount (COCI19_popcount)Cpython 3
110 / 110
33 ms3556 KiB
def main():
    n, K = map(int, input().split())
    code = []
    k = 0
    N = (1<<n)-1
    while (1 << k) < n:
        block = (1<<(1<<k))-1
        p = block;
        while p < (1<<n):
            p = p << (1<<(k+1))
            p = p | block
        p = p & N
        q = N ^ p
        code.append("A=((A&"+str(p)+")+((A&"+str(q)+")>>(1<<"+str(k)+")))")
        k += 1
    print(len(code))
    for x in code:
        print(x)                                              

main()
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...