- Notifications
You must be signed in to change notification settings - Fork 57
/
Copy pathDeathNote.java
28 lines (26 loc) · 862 Bytes
/
DeathNote.java
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
//problem: https://codeforces.com/problemset/problem/1016/A
importjava.util.Scanner;
publicclassDeathNote{
publicstaticvoidmain(String[] args){
ScannersObj = newScanner(System.in);
intdays = sObj.nextInt();
intmax = sObj.nextInt();
int[] arr = newint[days];
for(intz=0; z<days; z++){
arr[z] = sObj.nextInt();
}
intmodMax = max;
for(inti=0; i<days; i++){
//System.out.println("leftInPage: " + modMax + "\nToPrintToday: " + arr[i]);
if(arr[i]<modMax){
System.out.print(0);
modMax = modMax - arr[i];
}
else{
System.out.print((arr[i]-modMax)/max + 1);
modMax = max - ((arr[i]-modMax) % max);
}
System.out.print(" ");
}
}
}