-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaccenture_34.java
More file actions
44 lines (36 loc) · 904 Bytes
/
Copy pathaccenture_34.java
File metadata and controls
44 lines (36 loc) · 904 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
Climbing stairs
Alicec climbs a staircase and takes N steps to reach the top. In each turn Alice can climb 1 or M stairs. Find the minimum number of climbs to reach the top.
input format:
the input consists of a single line:
the first line contains two space separated integers N and M.
output format
Print the number that represents the minimum number of climbs required to reach the top.
Constraints:
- 1<=N<=10^9
- 1<=M<=10^9
Example:
Input:
5 1
output:
5
Explanation:
Alice can reach the top by 0->1->2->3->4->5
input2:
6 4
output:
3
*/
import java.util.Scanner;
public class accenture_34 {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int m=sc.nextInt();
sc.close();
if(n%m==0)
System.out.println(n/m);
else
System.out.println((n/m)+(n%m));
}
}