首页
比赛
tracker
题库
课程
竞赛讨论区
登录
/
注册
去牛客
首页
>
小红的不动点构造
8条解析
开通博客写题解
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
展开全文
查看本题
查看本题讨论
相关比赛
114848-牛客周赛 Round 104
进入比赛
115602-牛客周赛104内测
进入比赛
115853-123
进入比赛
116016-第八届传智杯山西大同大学院校选拔赛
进入比赛
116521-NJIT算法启程赛-day2
进入比赛
等你来战
查看全部
牛客小白月赛129
报名截止时间:2026-02-27 21:00
牛客周赛 Round 133
报名截止时间:2026-03-01 21:00
扫描二维码,关注牛客
意见反馈
下载牛客APP,随时随地刷题