Given 'N' cities the possible paths will be the permutation of 'N-1' cities as start and the end city is mentioned(i.e the home city).
The permutations is given by (N-1)!.(factorial of N-1).
-------------------------------------------------------------------------------------------------------------
#include<iostream>
using namespace std;
int fact(int);
int fact(int n)
{
if(n==1)
return 1;
else
{
return n*fact(n-1);
}
}
int main()
{
int n;
cin>>n;
string city[n];
for(int i=0;i<n;i++)
{
cin>>city[i];
}
string home;
cin>>home;
cout<<fact(n-1);
return 0;
}