Submission

Status:

P-PPP--PPP

Subtask/Task Score:

70/100

Score: 70

User: mik

Problemset: วิศวกรรมข้อมูล

Language: cpp

Time: 0.004 second

Submitted On: 2026-10-12 11:37:12

#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;
    }
    int d=1,ans=0;
    for (int i=res.size()-1;i>=0;i--){
        ans += d*(res[i]-'0');
        d*=2;
    }
    cout << ans;
    return 0;
}