Exemplo n.º 1
0
int main()
{
    vector<int> input = {1, 1};


    ZigZag z;
    int res = z.longestZigZag(input);
    cout << res << endl;
    return 0;
}
Exemplo n.º 2
0
int main()
{
	ZigZag z;
	vector<int>v{ 374, 40, 854, 203, 203, 156, 362, 279, 812, 955, 
600, 947, 978, 46, 100, 953, 670, 862, 568, 188, 
67, 669, 810, 704, 52, 861, 49, 640, 370, 908, 
477, 245, 413, 109, 659, 401, 483, 308, 609, 120, 
249, 22, 176, 279, 23, 22, 617, 462, 459, 244 };
	cout<<z.longestZigZag(v)<<endl;
	return 0;
}
Exemplo n.º 3
0
int main(int argc, char *argv[])
{
	ZigZag obj;
	vector<int> sequence;
	sequence.push_back(1);
	sequence.push_back(17);
	sequence.push_back(5);
	sequence.push_back(10);
	sequence.push_back(13);
	sequence.push_back(15);
	sequence.push_back(10);
	sequence.push_back(5);
	sequence.push_back(16);
	sequence.push_back(8);
	cout<<obj.longestZigZag(sequence)<<endl;
}
Exemplo n.º 4
0
int main()
{
	vector<int> v ;
	v.push_back(1);
	v.push_back(2);
	v.push_back(3);
	v.push_back(4);
	v.push_back(5);
	v.push_back(6);
	/*v.push_back(7);
	v.push_back(8);
	v.push_back(9);*/
	
	ZigZag z;

	cout<<"z.longestZigZag(v) "<<z.longestZigZag(v)<<endl;

}
Exemplo n.º 5
0
// BEGIN KAWIGIEDIT TESTING
// Generated by KawigiEdit 2.1.4 (beta) modified by pivanof
bool KawigiEdit_RunTest(int testNum, vector <int> p0, bool hasAnswer, int p1) {
	cout << "Test " << testNum << ": [" << "{";
	for (int i = 0; int(p0.size()) > i; ++i) {
		if (i > 0) {
			cout << ",";
		}
		cout << p0[i];
	}
	cout << "}";
	cout << "]" << endl;
	ZigZag *obj;
	int answer;
	obj = new ZigZag();
	clock_t startTime = clock();
	answer = obj->longestZigZag(p0);
	clock_t endTime = clock();
	delete obj;
	bool res;
	res = true;
	cout << "Time: " << double(endTime - startTime) / CLOCKS_PER_SEC << " seconds" << endl;
	if (hasAnswer) {
		cout << "Desired answer:" << endl;
		cout << "\t" << p1 << endl;
	}
	cout << "Your answer:" << endl;
	cout << "\t" << answer << endl;
	if (hasAnswer) {
		res = answer == p1;
	}
	if (!res) {
		cout << "DOESN'T MATCH!!!!" << endl;
	} else if (double(endTime - startTime) / CLOCKS_PER_SEC >= 2) {
		cout << "FAIL the timeout" << endl;
		res = false;
	} else if (hasAnswer) {
		cout << "Match :-)" << endl;
	} else {
		cout << "OK, but is it right?" << endl;
	}
	cout << "" << endl;
	return res;
}
Exemplo n.º 6
0
// BEGIN CUT HERE
void main( int argc, char* argv[] ) {
    {
        int sequenceARRAY[] = { 1, 7, 4, 9, 2, 5 };
        vector <int> sequence( sequenceARRAY, sequenceARRAY+ARRSIZE(sequenceARRAY) );
        ZigZag theObject;
        eq(0, theObject.longestZigZag(sequence),6);
    }
    {
        int sequenceARRAY[] = { 1, 17, 5, 10, 13, 15, 10, 5, 16, 8 };
        vector <int> sequence( sequenceARRAY, sequenceARRAY+ARRSIZE(sequenceARRAY) );
        ZigZag theObject;
        eq(1, theObject.longestZigZag(sequence),7);
    }
    {
        int sequenceARRAY[] = { 44 };
        vector <int> sequence( sequenceARRAY, sequenceARRAY+ARRSIZE(sequenceARRAY) );
        ZigZag theObject;
        eq(2, theObject.longestZigZag(sequence),1);
    }
    {
        int sequenceARRAY[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
        vector <int> sequence( sequenceARRAY, sequenceARRAY+ARRSIZE(sequenceARRAY) );
        ZigZag theObject;
        eq(3, theObject.longestZigZag(sequence),2);
    }
    {
        int sequenceARRAY[] = { 70, 55, 13, 2, 99, 2, 80, 80, 80, 80, 100, 19, 7, 5, 5, 5, 1000, 32, 32 };
        vector <int> sequence( sequenceARRAY, sequenceARRAY+ARRSIZE(sequenceARRAY) );
        ZigZag theObject;
        eq(4, theObject.longestZigZag(sequence),8);
    }
    {
        int sequenceARRAY[] = { 
		374, 40, 854, 203, 203, 156, 362, 279, 812, 955, 
		600, 947, 978, 46, 100, 953, 670, 862, 568, 188, 
		67, 669, 810, 704, 52, 861, 49, 640, 370, 908, 
		477, 245, 413, 109, 659, 401, 483, 308, 609, 120, 
		249, 22, 176, 279, 23, 22, 617, 462, 459, 244 }
           ;
        vector <int> sequence( sequenceARRAY, sequenceARRAY+ARRSIZE(sequenceARRAY) );
        ZigZag theObject;
        eq(5, theObject.longestZigZag(sequence),36);
    }
}