TAB

One of the works done by our Robotics and Machine Learning division,
SELF-LEVELING QUADCOPTER
Arduino based Quadcopter.
Self-leveling is acheived by the aligning the quadcopter using the readings from the gryo as well as the accelerometer.
A four channel RC transmitter is used to control the movement of the quadcopter when in flight. Kindly subscribe to our YouTube Channel and stay tuned.

Friday 12 February 2016

PRACTICE PROBLEM 3 : (11-2 to 17-2) : Guiding a Travelling Salesman


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;
}

1 comment: