#include <bits/stdc++.h>
using namespace std;
string checkbit(int i){
return "(A&(1<<"+to_string(i)+"))";
}
string bitshift(int i){
return "(1<<"+to_string(i)+")";
}
string getmaxint(int n){
return "((1<<"+to_string(n)+")-1)";
}
int main(){
int n,k;
cin >> n >> k;
if (k*4 >= n){
cout << (n+3)/4 << "\n";
for (int i = 0; i < n; i+= 4){
string add = checkbit(i),sub="("+getmaxint(n)+"-"+bitshift(i)+")";
for (int j = i+1; j < min(i+4,n); j++){
add = "("+add+"+"+checkbit(j)+")";
sub = "("+sub+"-"+bitshift(j)+")";
}
sub = "(A&"+sub+")";
string finalString = "A=("+add+"+"+sub+")";
cout << finalString << "\n";
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
384 KB |
Wrong answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
256 KB |
Wrong answer. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Accepted. |
2 |
Incorrect |
5 ms |
256 KB |
Wrong answer. |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
384 KB |
Wrong output format. |
2 |
Halted |
0 ms |
0 KB |
- |