Posts

Showing posts with the label Seating Arrangement

HackerEarth's basic programming solutions( Seating Arrangement, Zoos, Anagrams ) :

Problem 1: Seating Arrangement Solution: (in c++) ( please guys before moving to the solution try it yourself at least 3-4 times , if you really wanna become a good coder) #include< bits/stdc++.h > using namespace std ; int main () { long long t , s , p ; //t=no. of test cases cin >> t ; // s=seat no., p=corresponding seat no. while ( t --) { cin >> s ;      p = s % 12 ; //when to use modulo see below if ( p == 1 )      {          cout << s + 11 << " WS" << endl ;      }      else if ( p == 2 )      {          cout << s + 9 << " MS" << endl ;      } else if ( p == 3 )      {          cout << s + 7 << " AS" << endl ;      }      else if ( p == 4 )      {          cout << s + 5 << " AS" << endl ;      }      else if ( p == 5 )      {          cout << s + 3 << " MS" << endl ;