- 仔细读题,解题思路题目中已经给出
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#define ll long long
using namespace std;
ll m, n, ai;
int main()
{
cin >> n >> m;
vector<ll>c(n + 1);
vector<ll>bc(n + 1);
c[0] = 1;
for (size_t i = 0; i < n; i++)
{
cin >> ai;
c[i + 1] = c[i] * ai;
}
bc[0] = m % c[1];
for (size_t i = 1; i < n; i++)
{
bc[i] = m % c[i + 1] - bc[i];
}
for (size_t i = 0; i < n; i++)
{
bc[i] /= c[i];
cout << bc[i] << " ";
}
return 0;
}