#include using namespace std; int main(){ int n; cin >> n; vector calories(n); for(int calories_i = 0; calories_i < n; calories_i++){ cin >> calories[calories_i]; } int len = n * (n - 1); int result = 0; for (int x = 0; x < n; x++) { for (int y = 0; y < n; y++) { int h = 0; int pw = 0; h = 0 + (calories[x] * pow(2, pw)); pw++; // cout << "X "<< x <<": " << calories[x] << "\t" << h << " Nilai H " << "\n"; if (calories[x] != calories[y]) { h = h + (calories[y] * pow(2, pw)); // cout << "Y "<< y <<": " << calories[y] << "\t" << h << " Nilai H " << "\n"; pw++; for (int b = 0; b < n; b++) { if (calories[b] != calories[y] && calories[b] != calories[x]) { h = h + (calories[b] * pow(2, pw)); // cout << "B "<< b <<": " << calories[b] << "\t" << h << " Nilai H " << "\n"; } pw++; } // cout << "Nilai H : " << h << "\n"; if (result == 0) { result = h; } if (result > h && h != 0) { result = h; } } } } // your code goes here cout << result; return 0; }