思维
囿于昼夜one
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Educational Codeforces Round 89 (Rated for Div. 2)D
思路就是构造:以下构造方法学习自heyuyyy大佬#include <iostream>#include <cstring>#include <cstdio>#include <queue>#include <algorithm>#include <cmath>#include <vector>#include <map>using namespace std;#define inf.原创 2020-07-05 11:40:20 · 2838 阅读 · 0 评论 -
Codeforces Round #652 (Div. 2) AB
A,求一个正多边形有两条边分别平行于X和YB:注意到1…0这样的形式最后一定能变为一个0。那么因为要求字典序最小,所以贪心缩一下就行。#include<iostream>#include<cstdio>#include<cmath>using namespace std;const int maxn = 100000 + 5;int n, s[maxn];int main(){ int T; scanf("%d", &T); while原创 2020-06-30 22:29:29 · 263 阅读 · 0 评论 -
CF 647E Johnny and Grandmaster
注意随意取模的那个数全程也要用那个模数,计算qpow,不然会出错#include <iostream>#include <cstring>#include <cstdio>#include <algorithm>#include <queue>#include <vector>#include <string>#include <cmath>#include <set>#inc..原创 2020-06-24 18:00:53 · 270 阅读 · 0 评论 -
Codeforces Round #647 (Div. 2) D. Johnny and Contribution(贪心)
题意:Jony要写n篇博客,每篇博客的内容只能覆盖一个主题,但一个主题可以被多篇博客覆盖。在博客与博客之间可以相互引用,但是相互引用的博客不能涵盖相同的主题,否则博客是无效的。给出Jony要写的博客之间的相互引用关系,他在写博客的时候会依照这个引用关系来安排写博客的顺序,因此他在写博客的时候会首先查看他要引用的博客的主题,然后选出没有被覆盖的且主题编号最小的主题写入本篇博客。例如:若要的这篇博客引用的博客覆盖了主题1,3,2,5,那么这篇博客就应该要选择主题4编写。问是否存在一个写博客的顺序满足博客之间的相原创 2020-06-24 17:57:03 · 673 阅读 · 0 评论 -
Codeforces Round #644 (Div. 3) H Binary Median
题意:给你m代表有2^m 个不同的01串,现在去掉n个,问剩下的2^m-n个串中 排序后中位的字符串. 中位计算:(id-1)/2做法:因为m只有60,考虑字符串当作longlong的整数来算。最初的中位数一定是01111形式就是2^(m-1)-1.然后n只有100,考虑对初始的中位数上下枚举100个数,然后判断小于当前数和大于当前数是否相等。至于怎么 去掉 n 的 影响。对当前数在n中二分查找大于当前数x的个数。那么大于x的个数就少了这么多。#pragma GCC optimize(2)#inc原创 2020-06-20 23:50:13 · 205 阅读 · 0 评论 -
CodeForces - 1333D Challenges in school №41(构造+模拟)
#include <iostream>#include <cstring>#include <cstdio>#include <queue>#include <vector>using namespace std;#define inf 0x7fffffffvector<int> v[3000001];char...原创 2020-04-13 16:56:51 · 171 阅读 · 0 评论 -
bzoj3257 树的难题(树形DP)
Description给出一个无根树。树有N个点,边有权值。每个点都有颜色,是黑色、白色、灰色这三种颜色之一,称为一棵三色树。可爱的 Alice觉得,一个三色树为均衡的,当且仅当,树中不含有黑色结点或者含有至多一个白色节点。然而,给出的三色树可能并不满足这个性质。所以,Alice打算删去若干条边使得形成的森林中每棵树都是均衡的,花费的代价等于删去的边的权值之和。请你计算需要花费的代价最...原创 2019-10-01 16:08:24 · 572 阅读 · 1 评论 -
[HNOI]2003 消防局的建立
题目描述2020年,人类在火星上建立了一个庞大的基地群,总共有n个基地。起初为了节约材料,人类只修建了n-1条道路来连接这些基地,并且每两个基地都能够通过道路到达,所以所有的基地形成了一个巨大的树状结构。如果基地A到基地B至少要经过d条道路的话,我们称基地A到基地B的距离为d。由于火星上非常干燥,经常引发火灾,人类决定在火星上修建若干个消防局。消防局只能修建在基地里,每个消防局有能力扑灭与它距...转载 2019-09-30 20:24:30 · 194 阅读 · 0 评论 -
Primes and Multiplication
Let’s introduce some definitions that will be needed later.Let prime(x)prime(x) be the set of prime divisors of xx. For example, prime(140)={2,5,7}prime(140)={2,5,7}, prime(169)={13}prime(169)={13}....原创 2019-09-30 19:30:35 · 341 阅读 · 0 评论 -
洛谷P2585[ZJOI2006]三色二叉树(树形DP)
思路树形DP,首先是递归建树,然后是DP状态方程转移。代码#include<cstdio>#include<cstring>#include<algorithm>#include <cmath>#include<vector>#define ll long long#define inf 0x3f3f3f3f#def...原创 2019-09-27 21:00:07 · 721 阅读 · 0 评论 -
Codeforces 149D Coloring Brackets(区间dp)
给出一个合法的括号序列,要求给这个序列染色,求染色方案。1.可以选择无色、红色、蓝色。2.每一对括号要有且仅有一个染色的括号。3.相邻的括号不能有相同的颜色(无色没关系)#include<cstdio>#include<cstring>#include<algorithm>#define rep(i,a,b) for(int i=a;i<=b...原创 2019-09-17 22:30:20 · 245 阅读 · 1 评论 -
HDU - 6709 Fishing Master(2019中国大学生程序设计竞赛(CCPC) - 网络选拔赛)
Fishing Master(贪心)Heard that eom is a fishing MASTER, you want to acknowledge him as your mentor. As everybody knows, if you want to be a MASTER’s apprentice, you should pass the trial. So when you f...原创 2019-09-11 21:16:45 · 270 阅读 · 0 评论 -
Educational Codeforces Round 72 (Rated for Div. 2) C The Number Of Good Substrings
C. The Number Of Good SubstringsProblem Description:You are given a binary string s (recall that a string is binary if each character is either 0 or 1).Let f(t) be the decimal representation of int...原创 2019-09-06 20:38:48 · 167 阅读 · 0 评论 -
2018-2019 ACM-ICPC, Asia Nakhon Pathom Regional Contest E How Many Groups
How Many GroupsYou are given an array of n integers. Define a binary relation ~ on the elements of this arrayso that x ~ y if and only if |x – y| is less than or equal to 2. Let ~* be the transitive...转载 2019-09-03 22:01:26 · 334 阅读 · 0 评论 -
2019牛客多校四 K number(dp或前缀和)
转载至:https://www.cnblogs.com/rookie-acmer/p/11258415.htmlnumber题目描述300iq loves numbers who are multiple of 300.One day he got a string consisted of numbers. He wants to know how many substrings in ...转载 2019-08-31 23:29:18 · 272 阅读 · 0 评论 -
2019牛客暑期多校训练营(第五场) G subsequence 1(DP+组合数学)
题目描述You are given two strings s and t composed by digits (characters ‘0’ ∼\sim∼ ‘9’). The length of s is n and the length of t is m. The first character of both s and t aren’t ‘0’.Please calculate t...原创 2019-08-30 21:11:14 · 214 阅读 · 0 评论 -
2019牛客暑期多校训练营第一场 E题 ABBA
**ABBA**链接:https://ac.nowcoder.com/acm/contest/881/E?tdsourcetag=s_pcqq_aiomsg来源:牛客网题目描述Bobo has a string of length 2(n + m) which consists of characters A and B. The string also has a fascinati...原创 2019-08-29 16:43:16 · 284 阅读 · 0 评论 -
Fighting Monsters
**Fighting Monsters(German Collegiate Programming Contest 2018)**Emma just discovered a new card game called Gwint: A wizard’s game. There are two types of cards: monster cards and spell cards. Mon...原创 2019-08-27 20:09:44 · 948 阅读 · 1 评论
分享