Socket: Newton has shifted to a new house and it came to his notice that there is only one socket in his house !!!
Newton does a lot of experiments using electricity and wants at least B sockets in his house.
Furthermore, he has ample amount of extension cords and each extension has A sockets and takes one socket. In others words, an extension cord extends one socket into A sockets.
You need to tell Newton how many extension cords will be required so that he can have at least B sockets.
Input
The first and the only line of the input contains 2 single integers A and B
Constraints:
1) 2 ≤ A ≤ 200
2) 1 ≤ B ≤ 200
Output
Print the answer
Example
Sample Input 1:
4 10
Sample Output 1:
3
Sample Explanation 1:
3 power strips, each with 4 sockets, extend the socket into 10 empty sockets.
Sample Input 2:
8 9
Sample Output 2:
2
Solution
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int count = 0;
int sum = 1;
while (sum < b) {
sum += a - 1;
count++;
}
System.out.println(count);
}
}Happy Learning – If you require any further information, feel free to contact me.
![[Solved] Newton has shifted to a new house and it came to his notice [Solved] Newton has shifted to a new house and it came to his notice](https://realcoder.techss24.com/wp-content/uploads/2023/01/Solved-Newton-has-shifted-to-a-new-house-and-it-came-to-his-notice.png)
![[Solved] A cloud computing company can accommodate various requirements for resources](https://realcoder.techss24.com/wp-content/uploads/2022/11/Solved-A-cloud-computing-company-can-accommodate-various-requirements-for-resources-300x197.png)
![[Solved] Check If It Is a Straight Line](https://realcoder.techss24.com/wp-content/uploads/2022/12/Solved-Check-If-It-Is-a-Straight-Line-300x197.png)
![[Solved] A cold storage company has N storage units for various products](https://realcoder.techss24.com/wp-content/uploads/2022/11/Solved-A-cold-storage-company-has-N-storage-units-for-various-products-300x195.png)