Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
121382 | 林扬泉 | 序列变换 | C++ | 通过 | 100 | 112 MS | 4380 KB | 515 | 2024-01-21 17:15:51 |
#include<bits/stdc++.h> using namespace std; const int N=1e6+5; int n,m,a[N],prime[N]; int main(){ scanf("%d%d",&n,&m); for(int i=1;i<=n;i++){ scanf("%d",&a[i]); } while(m--){ int x,y,ch; scanf("%d",&ch); if(ch==1){ scanf("%d%d",&x,&y); prime[x]+=y; } else{ scanf("%d",&x); int res=a[x]; for(int i=1;i<=sqrt(x);i++){ if(x%i==0){ res+=prime[i]; if(i*i!=x){ res+=prime[x/i]; } } } printf("%d\n",res); } } return 0; }