// BEGIN CUT HERE int main( int argc, char* argv[] ) { { int candyCountsARRAY[] = {8,8}; vector <int> candyCounts( candyCountsARRAY, candyCountsARRAY+ARRSIZE(candyCountsARRAY) ); BoxesDiv2 theObject; eq(0, theObject.findSize(candyCounts),16); } { int candyCountsARRAY[] = {5,6}; vector <int> candyCounts( candyCountsARRAY, candyCountsARRAY+ARRSIZE(candyCountsARRAY) ); BoxesDiv2 theObject; eq(1, theObject.findSize(candyCounts),16); } { int candyCountsARRAY[] = {1,7}; vector <int> candyCounts( candyCountsARRAY, candyCountsARRAY+ARRSIZE(candyCountsARRAY) ); BoxesDiv2 theObject; eq(2, theObject.findSize(candyCounts),16); } { int candyCountsARRAY[] = {1,1,13,1,1}; vector <int> candyCounts( candyCountsARRAY, candyCountsARRAY+ARRSIZE(candyCountsARRAY) ); BoxesDiv2 theObject; eq(3, theObject.findSize(candyCounts),32); } { int candyCountsARRAY[] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32}; vector <int> candyCounts( candyCountsARRAY, candyCountsARRAY+ARRSIZE(candyCountsARRAY) ); BoxesDiv2 theObject; eq(4, theObject.findSize(candyCounts),1024); } return 0; }
int main(){ //int arr[] = {943, 828, 437, 392, 605, 903, 154, 293, 383, 422, 717, 719, 896, 448, 727, 772, 539}; int arr[] = {712, 254, 869}; vector<int> vec; for(int i=0;i<sizeof(arr)/sizeof(arr[0]);++i) vec.push_back(arr[i]); BoxesDiv2 bd; cout << bd.findSize(vec) << endl; return 0; }
double test1() { int t0[] = {5,6}; vector <int> p0(t0, t0+sizeof(t0)/sizeof(int)); BoxesDiv2 * obj = new BoxesDiv2(); clock_t start = clock(); int my_answer = obj->findSize(p0); clock_t end = clock(); delete obj; cout <<"Time: " <<(double)(end-start)/CLOCKS_PER_SEC <<" seconds" <<endl; int p1 = 16; cout <<"Desired answer: " <<endl; cout <<"\t" << p1 <<endl; cout <<"Your answer: " <<endl; cout <<"\t" << my_answer <<endl; if (p1 != my_answer) { cout <<"DOESN'T MATCH!!!!" <<endl <<endl; return -1; } else { cout <<"Match :-)" <<endl <<endl; return (double)(end-start)/CLOCKS_PER_SEC; } }
double test4() { int t0[] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32}; vector <int> p0(t0, t0+sizeof(t0)/sizeof(int)); BoxesDiv2 * obj = new BoxesDiv2(); clock_t start = clock(); int my_answer = obj->findSize(p0); clock_t end = clock(); delete obj; cout <<"Time: " <<(double)(end-start)/CLOCKS_PER_SEC <<" seconds" <<endl; int p1 = 1024; cout <<"Desired answer: " <<endl; cout <<"\t" << p1 <<endl; cout <<"Your answer: " <<endl; cout <<"\t" << my_answer <<endl; if (p1 != my_answer) { cout <<"DOESN'T MATCH!!!!" <<endl <<endl; return -1; } else { cout <<"Match :-)" <<endl <<endl; return (double)(end-start)/CLOCKS_PER_SEC; } }
int main(){ BoxesDiv2 solver; std::vector<int> candy = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32}; std::cout << solver.findSize(candy); return 0; }