不包含本位置的累积乘积
不包含本位置值的累乘数组
http://www.nowcoder.com/questionTerminal/49e3976085524094ac11c6c9b5c07a9d
include <bits/stdc++.h>
using namespace std;
int main()
{
int N,P;
cin>>N>>P;
vector<int> arr(N+2,1);
vector<long long=""> rev(N+2,1);
vector<long long=""> res(N+2,1);
for(int i=1;i<=N;i++)
{
cin>>arr[i];
res[i]=res[i-1]arr[i-1]%P;
}
for(int j=N;j>0;j--)
{
rev[j]=rev[j+1]arr[j+1]%P;
}
for(int i=1;i<=N;i++)
cout<<(rev[i]*res[i])%P<<" ";
return 0;
}</long></long></int>