CCF 202209-1如此编码
package ccf;
import java.util.Scanner;
public class c_202209_1 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int m = scanner.nextInt();
int[] num = new int[n+1];
int[] c= new int[n+1];
c[0] = 1;
for(int i = 1 ; i <= n; i++) {
num[i] = scanner.nextInt();
c[i] = num[i];
c[i] = c[i] * c[i-1];
}
if(m == 0) {
for(int i = 1;i<=n;i++) {
System.out.println(0);
}
}
else {
int[] b = new int[n+1];
int[] cb = new int[n+1];
int[] cb_sum = new int[n+1];
cb_sum[0] = 0;
for(int i = 1; i <= n;i++) {
cb_sum[i] = m % c[i];
cb[i] = cb_sum[i] - cb_sum[i-1];
b[i] = cb[i] / c[i-1];
}
for(int i = 1;i<=n;i++) {
System.out.print(b[i]+" ");
}
}
}
}