Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// https://quera.ir/problemset/contest/submissions/10325
import java.util.Scanner;
public class Main {
static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
String str = sc.nextLine();
String[] strs = str.trim().split(" ");
String res = "";
for (int i = 0; i < strs.length; i++) {
if(i>1)
return;
else if(i == 0 && ( Integer.parseInt(strs[i]) > 10 || Integer.parseInt(strs[i]) < 0 ) )
return;
else if(i == 1 && ( Integer.parseInt(strs[i]) > 20 || Integer.parseInt(strs[i]) < 0 ) )
return;
else if ( i == 0)
res = res + String.valueOf((11 - Integer.parseInt(strs[i])));
else if ( i == 1)
{
if(Integer.parseInt(strs[i]) <= 10)
res = "Right" + " " + res + " " + String.valueOf((Integer.parseInt(strs[i])));
else if(Integer.parseInt(strs[i]) > 10)
res = "Left" + " " + res + " " + String.valueOf((21 - Integer.parseInt(strs[i])));
}
}
System.out.println(res);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.