Salve. Sto provando a risolvere “Another boring problem”, ma credo ci sia un problema riguardante le operazioni che faccio col modulo. Qualcuno sa come aiutarmi?
// NOTE: it is recommended to use this even if you don't understand the following code.
#include <fstream>
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
// input data
int N, Q;
vector<int> A;
int main() {
// uncomment the following lines if you want to read/write from files
// ifstream cin("input.txt");
// ofstream cout("output.txt");
cin >> N;
A.resize(N);
for (int i = 0; i < N; i++) {
cin >> A[i];
}
cin >> Q;
for (int i = 0; i < Q; i++) {
int t;
cin >> t;
if (t == 1) {
int x;
cin >> x;
int ans = A[x] % 1000000007;
cout << ans << endl;
} else {
int x, y, b, c;
cin >> x >> y >> b >> c;
for(int j = x; j <= y; j++) {
int newA = (b*int(pow(j, c))) % 1000000007;
if (newA > A[j]) A[j] = newA;
}
// insert your code here
}
}
return 0;
}