提交时间:2021-12-14 13:08:04
运行 ID: 35307
#include <bits/stdc++.h> using namespace std; int num[1000005]; int main() { freopen("change.in","r",stdin); freopen("change.out","w",stdout); int n,m,opt; scanf("%d%d",&n,&m); for(int i=1; i<=n; i++) scanf("%d",&num[i]); while(m--) { scanf("%d",&opt); if(opt==1) { int x,y; scanf("%d%d",&x,&y); for(int k=1; k*x<=n; k++) num[k*x]+=y; } if(opt==2) { int x; scanf("%d",&x); printf("%d\n",num[x]); } } return 0; }