题解
include[HTML_REMOVED]
using namespace std;
const int MAXN = 10e6 + 50;
using namespace std;
int q, n, a[MAXN], op, x, y, z;
long long sum;
int main()
{
cin >> n;
for (int i = 1;i <= n;i++)cin >> a[i], sum += a[i];
cin >> q;
while (q–)
{
cin >> op >> x;
if (op == 1)
{
cin >> y;
int w = x - z;
if (w <= 0)w += n;
sum = sum - a[w] + y;
a[w] = y;
}
else {
z += x;
z %= n;
}
cout << sum << endl;
}
return 0;
}