22 int main(
int argc,
char **argv)
32 JParser<> zap(
"Example program to test permutations.");
40 catch(
const exception &error) {
41 FATAL(error.what() << endl);
50 if (
N > buffer.size()) {
51 FATAL(
"Number of elements " <<
N <<
" > " << buffer.size() << endl);
54 sort(buffer.begin(), buffer.end(), less<int>());
68 DEBUG(
'[' << setw(3) <<
n <<
']');
71 DEBUG(
' ' << setw(3) << *i);
77 data.rbegin()->insert(*i);
83 DEBUG(
' ' << setw(3) << *i);
91 for (
vector<
set<int> >::const_iterator p = data.begin(); p != data.end(); ++p) {
92 for (
vector<
set<int> >::const_iterator q = p; ++q != data.end(); ) {
98 NOTICE(
"number of permutations " <<
n <<
' ' <<
factorial(buffer.size(),
N) << endl);
Utility class to parse command line options.
long long int factorial(const long long int n)
Determine factorial.
#define ASSERT(A,...)
Assert macro.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
General purpose messaging.
counter_type advance(counter_type &counter, const counter_type value, const counter_type limit=std::numeric_limits< counter_type >::max())
Advance counter.
Utility class to parse command line options.
alias put_queue eval echo n
then usage $script[input file[working directory[option]]] nWhere option can be N
#define DEBUG(A)
Message macros.
int main(int argc, char *argv[])