首页 > 小红的不动点构造
头像 ddb酱
发表于 2025-11-17 11:13:01
#include <bits/stdc++.h> using namespace std; #define endl "\n" using vi = vector<int>; template<class T> void out(const T 展开全文
头像 千雪水岷
发表于 2025-11-19 21:31:36
//头文件,也可以使用万能头 #include <iostream> #include <vector> //主程序 int main() { int n = 0, k = 0; std::cin >> n >> k; if 展开全文
头像 慎独___
发表于 2026-02-02 03:07:48
n,k=map(int,input().split()) if n==k+1: print("-1") else: aList=[str(x) for x in range(1,k+1)] if n!=k: aList=aList+[str 展开全文
头像 yujun2007
发表于 2025-11-12 20:45:40
#include <iostream> #include <vector> using namespace std; int main() { int n,k; cin >> n >> k; vector< 展开全文
头像 自由的风0450
发表于 2025-11-22 14:59:16
#include <iostream> using namespace std; int main() { int n,k; cin>>n>>k; if(n==k+1){ cout<<-1; r 展开全文
头像 皮卡黄
发表于 2026-01-22 10:55:08
题解 题目分析 我们需要构造一个长度为 的排列,使得恰好有 个不动点。不动点是指满足 的位置 。 解题思路 观察发现,当 时,无法构造满足条件的排列。原因如下: 假设有 个不动点,那么剩下的 个位置不能是不动点 但是剩下的 个位置只能放剩下的 个数,而这个数必然等于这个位置(因为其 展开全文
头像 Yunlk
发表于 2025-12-10 11:16:12
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; if (abs(n - k) == 1) cout &l 展开全文
头像 牛客用户098471297
发表于 2025-12-05 11:19:33
#include<bits/stdc++.h> using namespace std; #define int long long #define endl '\n' #define quick ios::sync_with_stdio(false);cin.tie(0);cout.t 展开全文