Skip to content

Commit 6fd2c46

Browse files
authored
Create Lecture - 34.cpp
1 parent 864e603 commit 6fd2c46

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

Lecture - 34.cpp

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
//
2+
// main.cpp
3+
// Lecture 34
4+
//
5+
// Created by Prince Kumar on 17/04/19.
6+
// Copyright © 2019 Prince Kumar. All rights reserved.
7+
// -- * Problems from codechef -> Train Partner -- ANKTRAIN * -//
8+
9+
#include <iostream>
10+
using namespace std;
11+
int main()
12+
{
13+
int T; cin>>T;
14+
while(T--)
15+
{
16+
int n; // berth number
17+
cin>>n;
18+
if(n%8==0)
19+
{cout<<n-1<<"SL"<<endl;}
20+
else if(n%8==7)
21+
{cout<<n+1<<"SU"<<endl;}
22+
else if(n%8==1)
23+
{cout<<n+3<<"LB"<<endl;}
24+
else if(n%8==4)
25+
{cout<<n-3<<"LB"<<endl;}
26+
else if(n%8==2)
27+
{cout<<n+3<<"MB"<<endl;}
28+
else if(n%8==5)
29+
{cout<<n-3<<"MB"<<endl;}
30+
else if(n%8==3)
31+
{cout<<n+3<<"UB"<<endl;}
32+
else if(n%8==6)
33+
{cout<<n-3<<"UB"<<endl;}
34+
}
35+
}

0 commit comments

Comments
 (0)