上一页 1 2 3 4 5 6 7 8 ··· 13 下一页
摘要: https://ac.nowcoder.com/acm/contest/3007/E 放下题解 1 #include<bits/stdc++.h> 2 using namespace std; 3 typedef long long ll; 4 const int maxn = 32640; 5 l 阅读全文
posted @ 2020-02-18 16:10 AaronChang 阅读(214) 评论(0) 推荐(0)
摘要: https://ac.nowcoder.com/acm/contest/3007/C 将木板按照Xi从小到大排序,将这时的Yi数列记为Zi数列,则问题变成将Zi划分为尽可能少的若干组上升子序列。 根据Dilworth定理,最小组数等于Zi的最长下降子序列长度。 要求最长下降子序列的长度,我们有一种经 阅读全文
posted @ 2020-02-17 20:05 AaronChang 阅读(161) 评论(0) 推荐(0)
摘要: https://ac.nowcoder.com/acm/contest/3007/I 题中给定的图必定是一棵树 容易发现,如果将输入的N(N-1)个距离看做N(N-1)条无向边的话,那么如果数据合法,原树就是这张新图的最小生成树。 证明:由于边权是非负的,可以考虑Kruskal算法的过程,每一次引入 阅读全文
posted @ 2020-02-17 20:03 AaronChang 阅读(170) 评论(0) 推荐(0)
摘要: https://ac.nowcoder.com/acm/contest/3004/G 发现每个“1”对于它本身位置产生的影响贡献为0,对前面的“1”有产生贡献,对后面的"1"也产生贡献,用三个树状数组去维护,第一个维护“1”的个数,第二个每个“1”的位置,第三个维护“1”的贡献的前缀和,对于每个“1 阅读全文
posted @ 2020-02-14 19:06 AaronChang 阅读(181) 评论(0) 推荐(0)
摘要: https://ac.nowcoder.com/acm/problem/201961 预处理出僵尸走的路径,僵尸走的周期长度应该为2k-2,在普通的bfs基础上加上一维表示时间,从当前位置x,y和和时间t去更新新的x,y和时间t+1,vis数组也是三维的,等于多一层状态进行表示dis数组,把每个状态 阅读全文
posted @ 2020-02-14 18:57 AaronChang 阅读(181) 评论(0) 推荐(0)
摘要: https://ac.nowcoder.com/acm/contest/3006/B 三分做法 1 #include<bits/stdc++.h> 2 #define inf 0x3f3f3f3f 3 using namespace std; 4 typedef long long ll; 5 ty 阅读全文
posted @ 2020-02-14 18:52 AaronChang 阅读(153) 评论(0) 推荐(0)
摘要: https://ac.nowcoder.com/acm/contest/3003/J 题解: 1 #include<bits/stdc++.h> 2 typedef long long ll; 3 using namespace std; 4 const ll mod = 1e9+7; 5 cons 阅读全文
posted @ 2020-02-08 00:34 AaronChang 阅读(176) 评论(0) 推荐(0)
摘要: https://ac.nowcoder.com/acm/problem/200658 f(n) = f(n-1) * f(n-2) * ab ,f的第一项是x,第二项是y。 试着推出第三项是x·y·ab,第四项是x·y2·a2b,第五项是x2·y3·a4b,第六项是x3y5a7b 可以发现x的指数成 阅读全文
posted @ 2020-02-05 19:57 AaronChang 阅读(247) 评论(0) 推荐(0)
摘要: 快速幂 1 ll quick_mod(ll a,int n)//求a的n次方 2 { 3 ll sum=1;//注意是乘法,所以初始化为1 4 while(n) 5 { 6 if(n&1)//&运算符表示取这个数二进制的最后一位 7 { 8 sum=sum*a%mod;//若这位为1那么总和就应该乘 阅读全文
posted @ 2020-02-03 19:26 AaronChang 阅读(196) 评论(1) 推荐(0)
摘要: 1 #include<bits/stdc++.h> 2 using namespace std; 3 typedef long long ll; 4 const int mod = 1e9+7; 5 struct Matrix { 6 int a[3][3]; 7 Matrix() { memset 阅读全文
posted @ 2020-02-03 19:16 AaronChang 阅读(164) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 8 ··· 13 下一页