#include <iostream> #include <stdio.h> #include <map> #include <math.h> #include <algorithm> using namespace std; //M = sqrt(sumof(Mv)^2+sumof(Mh)^2) int per[8]={0,1,2,3,4,5,6,7}; int arr[322561]; int inp[8]; int main() { double Mv,Mh; double _max; int cnt=1; for(int i=0;i<8;i++) { arr[cnt]=per[i]; cnt++; } while(next_permutation(per,per+8)) { for(int i=0;i<8;i++) { arr[cnt]=per[i]; //cout<<arr[cnt]<<" "; cnt++; } } //cout<<cnt<<"\n"; while(cin>>inp[0]) { int sum=0; sum+=inp[0]; cin>>inp[1];
Category: Permutation
12335
Problem Solving Head start: Discussion is quoted from this link: So before proceed recall,if a<b<c<d and string is- abcd, there are 24 permutation,where 1-6 permutation start with smallest, here a. 7-12 permutation start with second smallest, here b. 13-18 permutation start with third smallest, here c. 19-24 permutation start with fourth smallest, here d. lets