#include <bits/stdc++.h>
usingnamespace std;
int main() {
int left, right, pos;
char c;
int n;
int q;
cin >> n;
string s[n];
for (int i = 0; i < n; ++i) {
cin >> s[i];
}
cin >> q;
int ans = 0;
for (int i = 0; i < q; ++i) {
ans = 0;
cin >> left >> right >> pos >> c;
for (int j = left - 1; j < right; ++j) {
if (s[j].length() >= pos - 1) {
if (s[j].at(pos - 1) == c) {
++ans;
}
}
}
cout << ans << "\n";
}
return 0;
}
Most compilers do not allow the creation of arrays at run time. They need to allot memory space for them at the time of compiling. I guess there can be a few compilers that will allow it, but not many, I'm sure.
is the formula we have to apply is this:-
volume = x*(A-x)*(B-x)
and then after differentiating it and put this equation equal to zero to find the value of x so that the volume can be maximised.
is this approach is correct?