新得了一道好题,请各位dalao指点指点
2024-06-02 13:14:44
发布于:北京
rt
好题
全部评论 10
顶
2024-06-03 来自 北京
0能发一下这道题的数据吗?
2024-06-02 来自 新加坡
0怎么发?
2024-06-02 来自 北京
0qq群里找到我
2024-06-02 来自 新加坡
0群号是多少
?2024-06-02 来自 北京
0
顶
2024-06-02 来自 北京
0限制太小了!!!
2024-06-01 来自 浙江
0哥,实在不行别用chatgpt
2024-06-01 来自 广东
0确实,我用的就是,不过你能在没有输入和输出的情况下做出来吗
2024-06-02 来自 浙江
0?小吗500ms还行吧
2024-06-02 来自 北京
0
using namespace std;
int main() {
int n, q, k;2024-06-01 来自 浙江
0cin >> n >> q >> k;
vector<int> products(n);
for (int i = 0; i < n; i++) {
cin >> products[i];
}2024-06-01 来自 浙江
0for (int i = 0; i < q; i++) {
int l, r, t;
cin >> l >> r >> t;
l -= 1;
r -= 1;2024-06-01 来自 浙江
0vector<int> current_positions(n);
for (int j = 0; j < n; j++) {
current_positions[j] = (j + t * k) % n;
}2024-06-01 来自 浙江
0vector<int> quality;
for (int j = 0; j < n; j++) {
if (current_positions[j] >= l && current_positions[j] <= r) {
quality.push_back(products[j]);
}2024-06-01 来自 浙江
0cout << *max_element(quality.begin(), quality.end()) - *min_element(quality.begin(), quality.end()) << endl;
}return 0;
}
2024-06-01 来自 浙江
0
有帮助,赞一个