└── java /java: -------------------------------------------------------------------------------- 1 | Alex finds himself in a peculiar situation at a magical event. Standing in a line of mysterious people, he wonders about his position. Can you unravel the magic and help Alex discover the number of enchanting places he might occupy in the lineup? 2 | 3 | Input Format 4 | 5 | The input consists of three integers. 6 | 7 | The total number of people in the magical lineup 'n'. The minimum number of people in front of Alex 'a'. The maximum number of people behind Alex 'b'. (0 ≤ a, b < n ≤ 100) 8 | 9 | Constraints 10 | 11 | Null 12 | 13 | Output Format 14 | 15 | A mystical number representing the potential magical positions for Alex. 16 | 17 | Sample Input 0 18 | 19 | 3 20 | 1 21 | 1 22 | Sample Output 0 23 | 24 | 1 25 | Sample Input 1 26 | 27 | 7 28 | 2 29 | 3 30 | Sample Output 1 31 | 32 | 2 33 | Sample Input 2 34 | 35 | 10 36 | 1 37 | 4 38 | Sample Output 2 39 | 40 | 5 41 | Sample Input 3 42 | 43 | 5 44 | 1 45 | 2 46 | Sample Output 3 47 | 48 | 2 49 | Contest ends in 3 days 50 | Submissions: 12 51 | Max Score: 10 52 | Difficulty: Easy 53 | Rate This Challenge: 54 | 55 | 56 | More 57 | 58 | 1 59 | 1 60 | import java.io.*; 61 | 2 62 | import java.util.*; 63 | 3 64 | ​ 65 | 4 66 | public class Solution { 67 | 5 68 | ​ 69 | 6 70 | public static void main(String[] args) { 71 | 7 72 | Scanner sc=new Scanner(System.in); 73 | 8 74 | int n1=sc.nextInt(); 75 | 9 76 | int n2=sc.nextInt(); 77 | 10 78 | int n3=sc.nextInt(); 79 | 11 80 | int r1,r2; 81 | 12 82 | r1=n1-n2; 83 | 13 84 | r2=r1-n3; 85 | 14 86 | System.out.print(r2); 87 | 15 88 | /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ 89 | 16 90 | } 91 | 17 92 | } 93 | --------------------------------------------------------------------------------