#include <bits/stdc++.h>
using namespace std;
#define SZ(x) (int)(x).size()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define RFOR(i,a,b) for (int i=(a);i>=(b);--i)
int f(int A, int N) {
cout << ((1<<N)-1) << " " << (1<<1) << " :: " << (A&((1<<N)-(1<<1))) << " " << ((A>>1)&1) << endl;
return ((A&(((1<<N)-1)-(1<<1)))+((A>>1)&1));
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int N, K; cin >> N >> K;
vector<string> ans;
for (int i = 1; i <= N-1; i += 4) {
string cur = "A=", ms = "";
vector<string> mask;
vector<string> stk;
for (int j = 0; j < 4 && i+j <= N-1; ++j) {
mask.push_back("((0-1)-(1<<" + to_string(i+j) + "))");
stk.push_back("((A>>" + to_string(i+j) + ")&1)");
}
FOR(i,0,SZ(mask)-1) ms += "(";
ms += "A";
FOR(i,0,SZ(mask)-1) ms += "&" + mask[i] + ")";
FOR(i,0,SZ(stk)-1) cur += "(";
cur += ms;
FOR(i,0,SZ(stk)-1) cur += "+" + stk[i] + ")";
assert(SZ(cur) <= 1000);
ans.push_back(cur);
}
cout << SZ(ans) << '\n';
for (auto& s : ans) cout << s << '\n';
//FOR(i,0,7) cout << f(i,3) << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Accepted. |
2 |
Correct |
4 ms |
384 KB |
Accepted. |
3 |
Correct |
5 ms |
384 KB |
Accepted. |
4 |
Correct |
5 ms |
384 KB |
Accepted. |
5 |
Correct |
4 ms |
384 KB |
Accepted. |
6 |
Correct |
5 ms |
384 KB |
Accepted. |
7 |
Correct |
5 ms |
384 KB |
Accepted. |
8 |
Correct |
4 ms |
384 KB |
Accepted. |
9 |
Correct |
5 ms |
384 KB |
Accepted. |
10 |
Correct |
5 ms |
384 KB |
Accepted. |
11 |
Correct |
5 ms |
384 KB |
Accepted. |
12 |
Correct |
5 ms |
384 KB |
Accepted. |
13 |
Correct |
5 ms |
384 KB |
Accepted. |
14 |
Correct |
5 ms |
384 KB |
Accepted. |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Accepted. |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Accepted. |
2 |
Correct |
4 ms |
384 KB |
Accepted. |
3 |
Correct |
5 ms |
384 KB |
Accepted. |
4 |
Correct |
5 ms |
384 KB |
Accepted. |
5 |
Correct |
5 ms |
384 KB |
Accepted. |
6 |
Correct |
4 ms |
384 KB |
Accepted. |
7 |
Correct |
5 ms |
384 KB |
Accepted. |
8 |
Correct |
5 ms |
384 KB |
Accepted. |
9 |
Correct |
5 ms |
384 KB |
Accepted. |
10 |
Correct |
5 ms |
384 KB |
Accepted. |
11 |
Incorrect |
5 ms |
384 KB |
Incorrect number of commands. |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
384 KB |
Incorrect number of commands. |
2 |
Halted |
0 ms |
0 KB |
- |