- 博客(26)
- 收藏
- 关注
原创 2020牛客暑期多校训练营(第十场)—— Tournament
2020牛客暑期多校训练营(第十场)—— Tournament输入234输出1 21 32 31 21 31 42 32 43 4题目大意题解首先,我们看到样例,会想到这个暴力代码:#include<bits/stdc++.h>using namespace std;int main(){ int T,n; scanf("%d",&T); while(T--) { scanf("%d",&n);
2020-08-10 20:59:17
269
原创 2020牛客暑期多校训练营(第九场)—— Groundhog and Gaming Time
2020牛客暑期多校训练营(第九场)—— Groundhog and Gaming Time输入62 21 21 41 53 53 6输出405536771备注1⩽n⩽5×10^5,0⩽Li⩽Ri⩽10^9.题目大意题解不同于官方题解通过树形dp的思路,我们的方法是通过累加每种情况对期望的贡献来求解。线段的交取决于最大的左端点以及最小的右端点,同时维护两个东西比较困难。当然,我们先添加上最左最优的端点,处理所有线段都不选择的情况;再按照
2020-08-09 20:57:16
213
原创 2020牛客暑期多校训练营(第九场)—— Groundhog Chasing Death
2020牛客暑期多校训练营(第九场)—— Groundhog Chasing Death输入样例11 2 1 2 8 4样例21 2 3 4 120 180输出样例12048样例2235140177题目大意求mod题解对给出的数分解质因数,然后对于每个质因数分别讨论其幂次。那么问题就从求 乘积问题转化为个子问题。对于每个子问题,在幂次上,形如给出两个数 , ,求。 那么可以枚举这个最小值是多少,是取到还是在取到,并可以????(1)求出每种
2020-08-09 13:20:09
211
1
原创 2020牛客暑期多校训练营(第九场)—— Groundhog Looking Dowdy
2020牛客暑期多校训练营(第九场)—— Groundhog Looking Dowdy输入4 31 32 8 61 23 1 7 5输出2说明Apple will pay attention to Groundhog's clothes on day 1, 3, and 4 ,Groundhog will wear clothes with dowdiness of 3, 2, and 1 on day 1, 3, and 4,and the difference
2020-08-08 20:28:01
211
原创 2020牛客暑期多校训练营(第九场)——Groundhog and 2-Power Representation
2020牛客暑期多校训练营(第九场)——Groundhog and 2-Power Representation输入2(2(2+2(0))+2)+2(2(2+2(0)))+2(2(2)+2(0))+2+2(0)输出1315备注The range of answers :[10,10^180],and the length of the input data shall not exceed 20000.题目大意输入计算式,求解。其中 2(x) 表示 2 的 x 次.
2020-08-08 19:40:41
160
原创 2020牛客暑期多校训练营(第八场)——Kabaleo Lite
2020牛客暑期多校训练营(第八场)——Kabaleo Lite样例输入232 -1 33 2 143 -2 3 -14 2 1 2样例输出Case #1: 3 8Case #2: 4 13说明For test case 1, the maximum number of visitors is 3, one of a possible solution is:The first visitor received food 1, the profit is 2
2020-08-04 15:29:57
194
原创 2020牛客暑期多校训练营(第八场)——Interesting Computer Game
2020牛客暑期多校训练营(第八场)——Interesting Computer Game样例输入261 22 33 41 41 32 451 21 21 32 35 6样例输出Case #1: 4Case #2: 4题目大意阿波罗正在玩有趣的电脑游戏。 游戏中有N轮。在每个回合中,计算机将为阿波罗提供两个整数ai和bi,并且阿波罗只能刚好执行一次以下三个操作之一。1.不做任何操作。2.如果之前所有回合都未选择整数ai,则阿波罗可以选择
2020-08-04 15:03:00
210
原创 2020牛客暑期多校训练营(第七场)——I Valuable Forests
2020牛客暑期多校训练营(第七场)——I Valuable Forests样例输入5 10000000072345107样例输出2242643240736935633题目大意题解不建议看官方题解(反正你也看不懂,否则为什么要来看博客)因为难度较大。本题核心在于推公式。因为个点的无根树可以形成个不同的树,我们设他的值为,设n个点的森林个数为。在第个点加入时,我们选择个点和他形成一棵树,那么就可以列出dp式:代码实现for(i...
2020-08-02 15:34:44
982
1
原创 2020牛客暑期多校训练营(第一场)——B Infinite Tree
2020牛客暑期多校训练营(第一场)——B Infinite Tree输入31 1 143 1 2 440 0 0 0输出3170题目大意题解首先,计算{1!, 2!, ..., n!}的“virual tree”;其次,要计算实际成本,请使用Segment Tree或Fenwick Tree.。(官方题解)事实上大家基本使用“虚树”来求解这题(要将整棵树全部保存下来是不可能的),可以通过相邻节点的lca 建树。我们先设数i,而i!分解质因数后.
2020-07-30 16:57:11
364
原创 2020牛客暑期多校训练营(第六场)——G Grid Coloring
2020牛客暑期多校训练营(第六场)——G Grid Coloring题目描述Roundgod draws a grid graph of size n×n cells. She can use one of k colors to color every edge once, but lzr gives her some limits.1.lzr loves balance. All colors should appear in the same number of times.2.lzr lo
2020-07-28 19:26:36
295
原创 2020牛客暑期多校训练营(第六场)—— Harmony Pairs
2020牛客暑期多校训练营(第六场)——Harmony Pairs题目描述输入描述The only line of input contains one integer N (1≤N≤10 100 ).输出描述Output one integer indicating the answer.样例输入100样例输出967题目大意题解AC code#include <bits/stdc++.h>using namespace std;const int N=1
2020-07-28 16:16:52
374
原创 2020牛客暑期多校训练营(第六场)——K K-Bag
2020牛客暑期多校训练营(第六场)——K K-Bag题目描述A sequence is called kk-bag, if and only if it is put in order by some (maybe one) permutations of 1 to k. For example, 1,2,3,2,1,3,3,2,1 is a valid 33-bag sequence.Roundgod is not satisfied with k-bag, so she put forward
2020-07-27 20:33:35
479
原创 2020牛客暑期多校训练营(第五场)——A Portal
2020牛客暑期多校训练营(第五场)——A Portal题目描述You are now in a big factory. The factory could be recognized as a graph with n vertices and m edges. Every edge has its length. You have k missions to do. The ith mission is going to vertex ai, picking a block and then se
2020-07-26 13:54:53
439
原创 2020牛客暑期多校训练营(第五场)——E Bogo Sort
2020牛客暑期多校训练营(第五场)——E Bogo Sort题目描述Today Tonnnny the monkey learned a new algorithm called Bogo Sort. The teacher gave Tonnnny the code of Bogo sort:bool is_sorted(int a[], int n) { for (int i = 1; i < n; i++) { if (a[i] < a[i - 1]
2020-07-25 20:33:07
369
原创 2020牛客暑期多校训练营(第四场)——I Investigating Legions
Investigating Legions题目描述输入描述输出描述输入110 20101110101010101010100010010101010100101010010输出0 0 1 0 1 0 1 0 1 0备注The sample input does not follow the input format, and it won't appear in the final test. The parameter isn=10,m=2,S..
2020-07-21 21:07:06
235
原创 2020牛客暑期多校训练营(第四场)——HHarder Gcd Problem
Harder Gcd Problem题目描述输入描述There are multiple test cases. The first line of input contains an integer T, indicating the number of test cases.For each test case, there is only one line containing an integer n (4≤n≤2×10 ^5)It's guaranteed that t..
2020-07-21 19:51:12
307
原创 2020牛客暑期多校训练营(第四场)——Basic Gcd Problem
Basic Gcd Problem题目描述输入描述The input contains multiple test cases. The first line of input contains one integer T(1≤T≤10^6).In the following T lines, each line contains two integers ni,ci(1≤ni,ci≤10^6) describing one question.输出描述For each.
2020-07-21 14:04:27
178
原创 2020牛客暑期多校训练营(第三场)E——Two Matchings
2020牛客暑期多校训练营(第三场)E——Two Matchings题目描述输入描述The first line contains one integer t (1≤t≤5×10^4) --- the number of test cases.Each test contains two lines. The first line contains one integer n (n≥4n \ge 4n≥4 and n is even), The second line contains n
2020-07-19 19:42:10
264
原创 2020牛客暑期多校训练营(第三场)D——Points Construction Problem
@[TOC](2020牛客暑期多校训练营(第三场)D——Points Construction Problem)题目描述输入描述The first line contains one integer t (1≤t≤10 3) — the number of test cases.The only line of each test case contains two integers n and m (1≤n≤50,1≤m≤200).输出描述For each test, if there ex
2020-07-19 19:13:28
202
原创 2020牛客暑期多校训练营(第三场) C——Operation Love
2020牛客暑期多校训练营(第三场)C ——Operation Love题目描述Alice is a beauty in a robot society. So many robots want to marry her. Alice determines to marry a robot who can solve the following puzzle:Firstly, the shape of Alice's right palm is as follow:And the shape o
2020-07-19 14:16:44
296
原创 Just Shuffle——2020牛客暑期多校训练营(第二场)J题
Just Shuffle——2020牛客暑期多校训练营(第二场)J题题目描述输入描述输出描述输入输出题解1.[逆元](https://blog.csdn.net/Harington/article/details/96310239)(一般以[扩展欧几里得,费马小定理或欧拉定理,特例,打表等方法求解](https://blog.csdn.net/guhaiteng/article/details/52123385))2.[置换群快速幂](https://wenku.baidu.com/view/0bff6b1
2020-07-15 15:09:36
397
1
原创 2020牛客暑期多校训练营(第二场)——F题(Fake Maxpooling)
Fake Maxpooling(2020牛客多校)题目描述输入描述输出描述样例输入样例输出说明题解单调队列代码题目链接题目描述Given a matrix of size n×m and an integerk, where A i,j=lcm(i,j), the least common multiple of i and j. You should determine the sum of the maximums among all k×k submatrices.输入描述Only one
2020-07-14 16:48:43
375
原创 Cover the Tree——2020牛客暑期多校训练营(第二场)C题
Cover the Tree题目输入描述输出描述样例输入样例输出说明题目大意解题思路AC但不是正解的代码AC正解题目地址题目Given an unrooted tree, you should choose the minimum number of chains that all edges in the tree are covered by at least one chain. Print the minimum number and one solution. If there are mu
2020-07-14 16:03:44
524
原创 Roundgod and Milk Tea (HTU-6667)
Roundgod and Milk Tea (HTU-6667)题目样例输入样例输出题目大意HTU-6667题目Roundgod is a famous milk tea lover at Nanjing University second to none. This year, he plans to conduct a milk tea festival. There will be n classes participating in this festival, where the it
2020-07-11 19:45:15
202
原创 dfs与bfs基础练习 变形课
dfs与bfs基础练习 变形课题目 (不可) 描述呃…变形课上Harry碰到了一点小麻烦,因为他并不像Hermione那样能够记住所有的咒语而随意的将一个棒球变成刺猬什么的,但是他发现了变形咒语的一个统一规律:如果咒语是以a开头b结尾的一个单词,那么它的作用就恰好是使A物体变成B物体.Harry已经将他所会的所有咒语都列成了一个表,他想让你帮忙计算一下他是否能完成老师的作业,将一个B(bal...
2019-12-15 16:00:48
159
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人