CodeForces 1992C Gorilla and Permutation

题目链接:CodeForces 1992C【Gorilla and Permutation】



思路

       根据题意只需要使得f(x)尽可能大,g(x)尽可能小,所以需要将大于等于n的数组排在序列的前端,且按由大到小的顺序依次排列,将小于等于m的数字排在序列的后端,且按从小到大的顺序依次排列。


代码

#include <functional>
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
using namespace std;
#define ll long long
const int N = 500 + 10;
int main() {
int t;
cin >> t;
while (t--) {
int n, m, k;
cin >> n >> m >> k;
for (int i = n; i > m; i--) {
cout << i << " ";
}
for (int i = 1; i <= m; i++) {
cout << i << " ";
}
cout << endl;
}
return 0;
}
posted @   薛定谔的AC  阅读(16)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 地球OL攻略 —— 某应届生求职总结
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 提示词工程——AI应用必不可少的技术
· .NET周刊【3月第1期 2025-03-02】
点击右上角即可分享
微信分享提示