From 72d36e4854631e2d3708c816d705b5f4dd62b2fc Mon Sep 17 00:00:00 2001 From: Hritik Maheshwari <60053891+CRAZYGEEKS04@users.noreply.github.com> Date: Mon, 4 Oct 2021 01:14:44 +0530 Subject: [PATCH] Create ANKTRAIN.java code in java. --- 2016/DEC/DEC16/ANKTRAIN/ANKTRAIN.java | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 2016/DEC/DEC16/ANKTRAIN/ANKTRAIN.java diff --git a/2016/DEC/DEC16/ANKTRAIN/ANKTRAIN.java b/2016/DEC/DEC16/ANKTRAIN/ANKTRAIN.java new file mode 100644 index 0000000..9347b2e --- /dev/null +++ b/2016/DEC/DEC16/ANKTRAIN/ANKTRAIN.java @@ -0,0 +1,24 @@ +import java.io.BufferedReader; +import java.io.InputStreamReader; + class RahulRashi { + + public static void main(String args[]) throws Exception { + BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); + int t = Integer.parseInt(bf.readLine()); + while (t-- > 0) { + + int p= Integer.parseInt(bf.readLine()); + String ans = ""; + int n= p%8; + if(n==0) + ans = ((7+(p>8?8*(p/8-1):0))+"SL"); + else if(n==7) + ans= ((8+(p>8?8*(p/8):0))+"SU"); + int tmp = (n>3?n-3:n+3) + (p>8?8*(p/8):0); + if(n==1 || n==4) ans=tmp+"LB"; + if(n==2 || n==5) ans= tmp+"MB"; + if(n==3 || n==6) ans=tmp+"UB"; + System.out.println(ans); + } + } +}