Task: | Ohjelmat |
Sender: | Kuha |
Submission time: | 2025-10-18 13:08:25 +0300 |
Language: | text (C++17) |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
test | verdict | time | score | |
---|---|---|---|---|
#1 | WRONG ANSWER | 0.00 s | 0 | details |
Code
#include <bits/stdc++.h> using namespace std; int main() { int t; cin>>t; while (t --> 0) { int x; cin>>x; vector<int> v = {0}; vector<string> out; while (1<<(v.back() + 1) <= x) { if (x & (1<<v.back())) { out.push_back("DUP"); out.push_back("DUP"); out.push_back("+"); v.push_back(v.back() + 1); } else { out.push_back("DUP"); out.push_back("+"); v.back()++; } } while (v.size() != 1) { out.push_back("+"); v.pop_back(); } cout<<out.size()<<endl; for (string s : out) cout<<s<<" "; cout<<endl; } }