Submission
Status:
----------
Subtask/Task Score:
0/100
Score: 0
User: mik
Problemset: วิศวกรรมข้อมูล
Language: cpp
Time: 0.004 second
Submitted On: 2026-10-12 11:36:36
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false),cin.tie(NULL);
string res="";
int n; cin >> n;
vector<int> a;
for (int i=0;i<n;i++){
int x; cin >> x;
string s="";
if (x==0) s="0";
while (x){
s = char(x%2+'0') + s;
x/=2;
}
res += s;
}
cout << res << '\n';
int d=1,ans=0;
for (int i=res.size()-1;i>=0;i--){
ans += d*(res[i]-'0');
cout << d << ' ' << ans << ' ' << d*(res[i]-'0') << '\n';
d*=2;
}
cout << ans;
return 0;
}