Click Here to go back to the homepage.

Jumbled Communication Solution:


#include <bits/stdc++.h>
using namespace std;

int main(){
    // #ifndef TESTING
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // #endif

    int nBytes;
    cin >> nBytes;

    while(nBytes--){
        int byte;
        cin >> byte;
        for(int i = 0; i < 256; i++){
            int trial = i ^ (i << 1);
            if(byte == trial % 256){
                cout << i << " ";
                break;
            }
        }
    }
   
    return 0;   
}