【HDU5187】zhx's contest】的更多相关文章

[问题描述] 作为史上最强的刷子之一,zhx的老师让他给学弟(mei)们出n道题.zhx认为第i道题的难度就是i.他想要让这些题目排列起来很漂亮. zhx认为一个漂亮的序列{ai}下列两个条件均需满足. 1:a1..ai是单调递减或者单调递增的. 2:ai..an是单调递减或者单调递增的. 他想你告诉他有多少种排列是漂亮的.因为答案很大,所以只需要输出答案模p之后的值. [题解] 对于整段序列单调增或减,就2种情况. 对于先增后减或先减后增:确定一个序列中的最小值(最大值),其他的要么在左边,要…
真的没有什么会写的东西了QAQ 原题: As one of the most powerful brushes, zhx is required to give his juniors n problems.zhx thinks the ith problem's difficulty is i. He wants to arrange these problems in a beautiful way.zhx defines a sequence {ai} beautiful if there…
点此进入比赛 \(A\):XOR Circle(点此看题面) 大致题意: 给你\(n\)个数,问是否能将它们摆成一个环,使得环上每个位置都是其相邻两个位置上值的异或值. 先不考虑\(0\),我们假设环上第一个数是\(a_1\),第二个数是\(a_2\),则第三个数\(a_3=a_1\ xor\ a_2\),第四个数\(a_4=a_2\ xor\ a_3=a_1\)... 以此类推,也就是说,一个合法的环上必然是\(a_1,a_2,a_1\ xor\ a_2\)三者重复. 整理一下,就是要满足:…
http://poj.org/problem?id=2187 显然直径在凸包上(黑书上有证明).(然后这题让我发现我之前好几次凸包的排序都错了QAQ只排序了x轴.....没有排序y轴.. 然后本题数据水,暴力也能过... (之前一直以为距离是单增的,其实并不是,应该是三角形面积单增...) 考虑旋转卡壳 一篇好的文章:http://www.cnblogs.com/Booble/archive/2011/04/03/2004865.html 首先对踵点就是两条平行线夹紧凸包的两个点(或者3个点或4…
Tenka1 Programmer Contest 2019 C - Stones 题面大意:有一个01序列,改变一个位置上的值花费1,问变成没有0在1右边的序列花费最少多少 直接枚举前i个都变成0即可 #include <bits/stdc++.h> #define fi first #define se second #define pii pair<int,int> #define mp make_pair #define pb push_back #define space…
原题 During the NBA playoffs, we always arrange the rather strong team to play with the rather weak team, like make the rank 1 team play with the rank nth team, which is a good strategy to make the contest more interesting. Now, you're given n teams, y…
M-SOLUTIONS Programming Contest A - Sum of Interior Angles #include <bits/stdc++.h> #define fi first #define se second #define pii pair<int,int> #define mp make_pair #define pb push_back #define space putchar(' ') #define enter putchar('\n') #…
作者: 负雪明烛 id: fuxuemingzhu 个人博客:http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 遍历 日期 题目地址:https://leetcode-cn.com/problems/output-contest-matches/ 题目描述 During the NBA playoffs, we always arrange the rather strong team to play with the rather weak team, lik…
A - Anti-Adjacency K <= (N + 1) / 2 #include <bits/stdc++.h> #define fi first #define se second #define pii pair<int,int> #define mp make_pair #define pb push_back #define space putchar(' ') #define enter putchar('\n') #define MAXN 40005 #d…
C - 4/N 列出个方程枚举解一下 #include <bits/stdc++.h> #define fi first #define se second #define pii pair<int,int> #define mp make_pair #define pb push_back #define space putchar(' ') #define enter putchar('\n') #define MAXN 4005 #define eps 1e-10 //#de…