My issue
how to access the custom input or how is the input handled
My code
// your code goes here
Problem Link: TRAVELLING - SEATING ARRANGEMENT Practice Coding Problem - CodeChef
how to access the custom input or how is the input handled
// your code goes here
Problem Link: TRAVELLING - SEATING ARRANGEMENT Practice Coding Problem - CodeChef
@raghavikannan
plzz refer the following code
#include <iostream>
using namespace std;
int main() {
int cases;
cin >> cases;
while (cases--) {
int m;
cin >> m;
//aisle
int a = (m+3)%6;
int b = (m+2)%6;
//mid
int c = (m+1)%3;
//window
int d = (m+5)%6;
int e = m%6;
// Calculate the facing seat number and seat type
int compartment_start = (m - 1) / 12 * 12 + 1;
int opposite_seat = compartment_start + 11 - (m - compartment_start);
string seat_type;
if( a==0 || b==0) {
seat_type = "AS";
}
else if(c==0){
seat_type = "MS";
}
else if(d==0 || e==0) {
seat_type = "WS";
}
cout << opposite_seat << " " << seat_type << endl;
}
return 0;
}