-
Notifications
You must be signed in to change notification settings - Fork 1
/
seatingArrangement.cpp
32 lines (31 loc) · 1007 Bytes
/
seatingArrangement.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/**
https://www.hackerearth.com/practice/basic-programming/input-output/basics-of-input-output/practice-problems/algorithm/seating-arrangement-1/
*/
#include <iostream>
using namespace std;
int main()
{
long test;
int seat;
cin>>test;
for(int i=0;i<test;i++)
{
cin>>seat;
switch(seat%12)
{
case 1: cout<<seat+11<<" WS"<<endl;break;
case 2: cout<<seat+9<<" MS"<<endl;break;
case 3: cout<<seat+7<<" AS"<<endl;break;
case 4: cout<<seat+5<<" AS"<<endl;break;
case 5: cout<<seat+3<<" MS"<<endl;break;
case 6: cout<<seat+1<<" WS"<<endl;break;
case 7: cout<<seat-1<<" WS"<<endl;break;
case 8: cout<<seat-3<<" MS"<<endl;break;
case 9: cout<<seat-5<<" AS"<<endl;break;
case 10: cout<<seat-7<<" AS"<<endl;break;
case 11: cout<<seat-9<<" MS"<<endl;break;
case 0: cout<<seat-11<<" WS"<<endl;break;
}
}
return 0;
}