0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2025-01-11 18:51:59 +00:00

P1438 无聊的数列

R52424356
This commit is contained in:
Baoshuo Ren 2021-07-05 15:02:37 +08:00 committed by Baoshuo Ren
parent 75d79a2ceb
commit 96c040b270
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

View File

@ -0,0 +1,25 @@
#include <bits/stdc++.h>
using namespace std;
int n, m, op, l, r, k, d, p, a[100005];
int main() {
cin >> n >> m;
for(int i = 1 ; i <= n ; i++) {
cin >> a[i];
}
for(int i = 0 ; i < m ; i++) {
cin >> op;
if(op == 1) {
cin >> l >> r >> k >> d;
for(int j = l ; j <= r ; j++) {
a[j] += k + (j - l) * d;
}
} else if(op == 2) {
cin >> p;
cout << a[p] << endl;
}
}
return 0;
}