| Task: | Program |
| Sender: | aalto25e_001 |
| Submission time: | 2025-10-01 16:59:39 +0300 |
| Language: | C++ (C++11) |
| Status: | COMPILE ERROR |
Compiler report
input/code.cpp: In function 'int main()':
input/code.cpp:27:3: error: 'reverse' was not declared in this scope
27 | reverse(op.begin(), op.end());
| ^~~~~~~Code
#include <iostream>
#include <vector>
using namespace std;
long long n;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cin >> n;
if (n % 3 == 0) {
cout << 0 << '\n';
return 0;
}
vector<string> op;
op.emplace_back("END");
while (n > 1) {
if (n % 2 == 0) {
op.emplace_back("MUL");
n /= 2;
} else {
n -= 3;
op.emplace_back("ADD");
}
}
reverse(op.begin(), op.end());
cout << op.size() << '\n';
for (auto x : op) {
cout << x << '\n';
}
return 0;
}
