首页
比赛
tracker
题库
课程
竞赛讨论区
登录
/
注册
去牛客
首页
>
小红的异或构造
8条解析
开通博客写题解
Ldh1315109
发表于 2025-11-07 17:18:57
小红的异或构造 令就可以满足条件。 def solve(testcase): print(*[i for i in range(1, II() + 1)]) for testcase in range(1): solve(testcase)
千雪水岷
发表于 2025-11-19 20:57:58
//头文件,也可以使用万能头 #include <iostream> #include <vector> //主程序 int main() { int n = 0; ////n变量主要是看长度 std::cin >> n; // 令a
展开全文
丘馗
发表于 2026-01-08 16:30:00
#include <iostream> using namespace std; int main() { int n;cin>>n; for(int i=1;i<=n;i++) { cout<<i<<&
展开全文
该昵称已被占用_Error0_
发表于 2026-02-22 17:49:48
这道题看着复杂,实际上很简单,题目要求 xor = xor ,其实这里你可以不用管xor到底是什么,你只需要知道,当对于所有的时, 无论和到底是什么, xor 就一定等于 xor 实现代码: #include <iostream> using namespace std; in
展开全文
自由的风0450
发表于 2025-11-22 14:46:51
#include <iostream> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin>>n; f
展开全文
游云吞鲸
发表于 2026-01-18 14:16:14
#include <bits/stdc++.h> using namespace std; #define int long long signed main() { int n;cin>>n; for(int i=1;i<=n;i++) cout&l
展开全文
lotusor
发表于 2025-12-07 00:03:17
n = int(input()) C = n+1 ans = [C ^ i for i in range(1, n + 1)] print(' '.join(map(str, ans))) 本题需要用到异或的数学性质,不难发现本题的构造可以改写为ai异或i = aj 异或j,这就表明数列的所有异或结
展开全文
牛客用户098471297
发表于 2025-12-05 10:59:13
#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
展开全文
查看本题
查看本题讨论
等你来战
查看全部
牛客周赛 Round 133
报名截止时间:2026-03-01 21:00
【小羊肖恩】小羊杯 Round 3
报名截止时间:2026-03-15 18:00
扫描二维码,关注牛客
意见反馈
下载牛客APP,随时随地刷题