提交时间:2022-10-15 11:25:07
运行 ID: 60318
#include<bits/stdc++.h> using namespace std; const int N=1e5+10; int n,m,a[N]; long long now; int main(){ //freopen("S2.in","r",stdin); //freopen("S2.out","w",stdout); scanf("%d%d",&n,&m); for(register int i=1;i<=m;i++){ scanf("%d",&a[i]); } for(register int i=1;i<=n;i++){ now=i; for(register int j=1;j<=m;j++){ long long kk=now/a[j]; if(kk*a[j]<now) kk++; now=kk*a[j]; } printf("%lld ",now); } return 0; }