All pastes #512540 Raw Edit

Stuff

public cpp v1 · immutable
#512540 ·published 2007-05-26 22:52 UTC
rendered paste body
#include <iostream>#include <vector>#include <sstream>using namespace std;class Fibs {public:	Fibs() {		t.push_back(0);		t.push_back(1);	}	int operator[]( int n ) {		while ( n >= t.size() ) {			t.push_back( t.rbegin()[0] + t.rbegin()[1] );		}		return t[n-1];	}protected:	vector<int> t;};int main( int argc, char** argv ) {	istringstream src;	src.str( argv[1] );		int n;	src >> n;			Fibs f;		cout << f[n] << endl;}