[Assorted-commits] SF.net SVN: assorted: [823] configs/trunk/src/topcoder/template.cpp
Brought to you by:
yangzhang
From: <yan...@us...> - 2008-05-15 00:04:00
|
Revision: 823 http://assorted.svn.sourceforge.net/assorted/?rev=823&view=rev Author: yangzhang Date: 2008-05-14 17:04:02 -0700 (Wed, 14 May 2008) Log Message: ----------- making way for new template.cpp Removed Paths: ------------- configs/trunk/src/topcoder/template.cpp Deleted: configs/trunk/src/topcoder/template.cpp =================================================================== --- configs/trunk/src/topcoder/template.cpp 2008-05-14 23:20:40 UTC (rev 822) +++ configs/trunk/src/topcoder/template.cpp 2008-05-15 00:04:02 UTC (rev 823) @@ -1,171 +0,0 @@ -// vim:et:sw=2:ts=2 - -$BEGINCUT$ -#if 0 -$PROBLEMDESC$ -#endif -$ENDCUT$ - - - - - - - -//#line $NEXTLINENUMBER$ "$FILENAME$" -#include <algorithm> -#include <cassert> -#include <cctype> -#include <cmath> -#include <cstdio> -#include <cstdlib> -#include <deque> -#include <iostream> -#include <map> -#include <queue> -#include <set> -#include <sstream> -#include <stack> -#include <string> -#include <vector> -using namespace std; - -#define ARRSIZE(x) (sizeof(x)/sizeof(x[0])) - - - - - - - -$BEGINCUT$ -template<typename T> void print( T a ) { - cerr << a; -} -static void print( long long a ) { - cerr << a << "L"; -} -static void print( string a ) { - cerr << '"' << a << '"'; -} -template<typename T> void print( vector<T> a ) { - cerr << "{"; - for ( int i = 0 ; i != a.size() ; i++ ) { - if ( i != 0 ) cerr << ", "; - print( a[i] ); - } - cerr << "}" << endl; -} -template<typename T> void eq( int n, T have, T need ) { - if ( have == need ) { - cerr << "Case " << n << " passed." << endl; - } else { - cerr << "Case " << n << " failed: expected "; - print( need ); - cerr << " received "; - print( have ); - cerr << "." << endl; - } -} -template<typename T> void eq( int n, vector<T> have, vector<T> need ) { - if( have.size() != need.size() ) { - cerr << "Case " << n << " failed: returned " << have.size() << " elements; expected " << need.size() << " elements." << endl; - cerr << " have: "; print( have ); - cerr << " need: "; print( need ); - return; - } - for( size_t i= 0; i < have.size(); i++ ) { - if( have[i] != need[i] ) { - cerr << "Case " << n << " failed. Expected and returned array differ in position " << i << "." << endl; - cerr << " have: "; print( have ); - cerr << " need: "; print( need ); - return; - } - } - cerr << "Case " << n << " passed." << endl; -} -static void eq( int n, string have, string need ) { - if ( have == need ) { - cerr << "Case " << n << " passed." << endl; - } else { - cerr << "Case " << n << " failed: expected "; - print( need ); - cerr << " received "; - print( have ); - cerr << "." << endl; - } -} -$ENDCUT$ - - - - - - - -$BEGINCUT$ -#if 0 -template<typename T> void pp(const T & xs) { - for (typename T::const_iterator it = xs.begin(); - it != xs.end(); - it++) - cout << *it << " "; - cout << endl; -} - -vector<string> split( const string& s, const string& delim =" " ) { - vector<string> res; - string t; - for ( int i = 0 ; i != s.size() ; i++ ) { - if ( delim.find( s[i] ) != string::npos ) { - if ( !t.empty() ) { - res.push_back( t ); - t = ""; - } - } else { - t += s[i]; - } - } - if ( !t.empty() ) { - res.push_back(t); - } - return res; -} - -vector<int> splitInt( const string& s, const string& delim =" " ) { - vector<string> tok = split( s, delim ); - vector<int> res; - for ( int i = 0 ; i != tok.size(); i++ ) - res.push_back( atoi( tok[i].c_str() ) ); - return res; -} -#endif -$ENDCUT$ - - - - - - - -class $CLASSNAME$ { - public: - $RC$ $METHODNAME$($METHODPARMS$) { - $RC$ res; - return res; - } -}; - - - - - - - -$BEGINCUT$ -int main() { - $MAINBODY$ - cin.get(); - return 0; -} -$ENDCUT$ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |