All pastes #2071636 Raw Edit

Something

public cpp v1 · immutable
#2071636 ·published 2011-05-29 16:35 UTC
rendered paste body
#include <iostream>#include <vector>using namespace std;class Result {private: //int first; //int second; //int third; //int fourth; int data[4];public:  Result(int first, int second, int third, int fourth) {    data[0] = first;    data[1] = second;    data[2] = third;    data[3] = fourth;  }  Result() {    Result(0,0,0,0);  }  int getElementAt(int i) {    return data[i];  }};int main(int argc, char *argv[]){ int a[] = {0, 29, 66, 93, 158, 226}; int b[] = {0, 39, 70, 129, 164, 226}; int c[] = {0, 28, 52, 100, 180, 250}; int d[] = {0, 50, 100, 150, 200, 250}; Result r[625]; int i, j, k, l, min = 250, r_index = 0; for(i = 0; i < 6; i++) for(j = 0; j < 6; j++) for(k = 0; k < 6; k++) for(l = 0; l < 6; l++) { if(i+j+k+l == 5 && a[i] + b[j] + c[k] + d[l] <= min ) { //r[r_index].first = i; //r[r_index].second = j; //r[r_index].third = k; //r[r_index].fourth = l; r[r_index] = Result(i,j,k,l); r_index++; min = a[i] + b[j] + c[k] + d[l]; } } for (i = 0; i <= r_index; i++) { //printf("%d %d %d %d\n", r[i].first, r[i].second, r[i].third, r[i].fourth);  //cout << r[i].first << " " << r[i].second << " "<< r[i].third << " " << r[i].fourth << endl;  cout << r[i].getElementAt(0) << " " << r[i].getElementAt(1) << " "<< r[i].getElementAt(2) << " " << r[i].getElementAt(3) << endl; } cin.get(); return 0;}