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])
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
26 ms |
3436 KB |
Accepted. |
2 |
Correct |
25 ms |
3308 KB |
Accepted. |
3 |
Correct |
26 ms |
3436 KB |
Accepted. |
4 |
Correct |
25 ms |
3436 KB |
Accepted. |
5 |
Correct |
32 ms |
3556 KB |
Accepted. |
6 |
Correct |
26 ms |
3428 KB |
Accepted. |
7 |
Correct |
26 ms |
3308 KB |
Accepted. |
8 |
Correct |
25 ms |
3436 KB |
Accepted. |
9 |
Correct |
25 ms |
3436 KB |
Accepted. |
10 |
Correct |
26 ms |
3436 KB |
Accepted. |
11 |
Correct |
27 ms |
3428 KB |
Accepted. |
12 |
Correct |
26 ms |
3428 KB |
Accepted. |
13 |
Correct |
25 ms |
3436 KB |
Accepted. |
14 |
Correct |
26 ms |
3436 KB |
Accepted. |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
29 ms |
3420 KB |
Accepted. |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
26 ms |
3564 KB |
Accepted. |
2 |
Correct |
25 ms |
3436 KB |
Accepted. |
3 |
Correct |
33 ms |
3428 KB |
Accepted. |
4 |
Correct |
26 ms |
3436 KB |
Accepted. |
5 |
Correct |
25 ms |
3436 KB |
Accepted. |
6 |
Correct |
26 ms |
3436 KB |
Accepted. |
7 |
Correct |
25 ms |
3348 KB |
Accepted. |
8 |
Correct |
25 ms |
3436 KB |
Accepted. |
9 |
Correct |
25 ms |
3436 KB |
Accepted. |
10 |
Correct |
45 ms |
3436 KB |
Accepted. |
11 |
Correct |
25 ms |
3436 KB |
Accepted. |
12 |
Correct |
29 ms |
3436 KB |
Accepted. |
13 |
Correct |
25 ms |
3436 KB |
Accepted. |
14 |
Correct |
26 ms |
3436 KB |
Accepted. |
15 |
Correct |
25 ms |
3428 KB |
Accepted. |
16 |
Correct |
26 ms |
3436 KB |
Accepted. |
17 |
Correct |
25 ms |
3436 KB |
Accepted. |
18 |
Correct |
25 ms |
3436 KB |
Accepted. |
19 |
Correct |
25 ms |
3436 KB |
Accepted. |
20 |
Correct |
25 ms |
3436 KB |
Accepted. |
21 |
Correct |
28 ms |
3436 KB |
Accepted. |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
25 ms |
3428 KB |
Accepted. |
2 |
Correct |
26 ms |
3436 KB |
Accepted. |
3 |
Correct |
26 ms |
3436 KB |
Accepted. |
4 |
Correct |
26 ms |
3436 KB |
Accepted. |
5 |
Correct |
26 ms |
3436 KB |
Accepted. |
6 |
Correct |
25 ms |
3428 KB |
Accepted. |
7 |
Correct |
25 ms |
3436 KB |
Accepted. |
8 |
Correct |
25 ms |
3428 KB |
Accepted. |
9 |
Correct |
27 ms |
3436 KB |
Accepted. |
10 |
Correct |
34 ms |
3428 KB |
Accepted. |
11 |
Correct |
25 ms |
3436 KB |
Accepted. |
12 |
Correct |
25 ms |
3420 KB |
Accepted. |