首页
比赛
题库
课程
竞赛讨论区
登录
/
注册
去牛客
首页
>
XOR-pyramid
6条解析
开通博客写题解
sunsetcolors
发表于 2020-08-24 18:19:56
XOR-pyramid 题目地址: https://ac.nowcoder.com/acm/problem/112798 基本思路: 肯定不能暴力求所有,所以我们要找到它的递推关系,我们带入几个数字将化开: 也就是所以我们设,为这段区间的结果,我们能够得到,然后我们是每次是要找到里结果最大
展开全文
luo想要个气球
发表于 2020-08-27 14:16:19
题意: 思路: #include <cstdio> #include <algorithm> using namespace std; const int N = 5e3 + 10; int n,f[N][N],mx[N][N]; int main(){ scan
展开全文
issue是云哥的小迷×呀
发表于 2020-08-24 23:00:30
#include <bits/stdc++.h> using namespace std; const int maxn=5009; int a[maxn],n,dp[maxn][maxn],f[maxn][maxn]; int main() { cin >> n;
展开全文
sunrise__sunrise
发表于 2020-08-24 23:25:08
题目描述 给出n个数,n<5000第二行给出n个数的权值分别是多少,给出f函数的定义,是依次相邻的异或,直到最终函数参数只有一个,得到的值就是参数的值。下面给出q次询问,每次询问给出l,r,问在这个区间中最大的f是什么? Solution 异或可以抵消,所以枚举起来不是很复杂,我枚举了长度为3
展开全文
程序蒟蒻
发表于 2020-08-29 12:08:05
可以发现,f([l,r])迭代到倒数第二层,会变成f(f([l,r−1]),f([l+1,r]))=f([l,r−1])⊕f([l+1,r]) #include<iostream> #include<string> #include<math.h> #includ
展开全文
blowhail
发表于 2020-08-29 12:44:46
推导一下f的式子所以用dp[l][r]来表示区间l,r的答案就可以得到 dp[l][r]=dp[l][r-1] dp[l+1][r] #include <cstdio> #include <iostream> #include <algorithm> #incl
展开全文
查看本题
查看本题讨论
等你来战
查看全部
牛客小白月赛117
报名截止时间:2025-05-30 21:00
牛客2025年儿童节比赛
报名截止时间:2025-06-01 21:00
浙江广厦大学第八届程序设计比赛
报名截止时间:2025-06-04 20:40
牛客练习赛140
报名截止时间:2025-06-06 21:30
第二十二届宁波大学程序设计竞赛(同步赛)
报名截止时间:2025-06-08 17:00
衡阳师范学院第二十五届程序设计竞赛(同步赛)
报名截止时间:2025-06-08 18:00
牛客周赛 Round 95
报名截止时间:2025-06-08 21:00
2025牛客暑期多校训练营1
报名截止时间:2025-07-15 17:00
扫描二维码,关注牛客
意见反馈
下载牛客APP,随时随地刷题