上一页 1 2 3 4 5 6 ··· 14 下一页
摘要: 给一个数字 n ,(1<=n<=1e18)。让你找一些数字加起来和为 n ,数字个数不超过50个而且数字都是回文数字。 每次找到大小最接近这个数的回文数即可。如6745888可以找到6745476,6960242可以找到6950595。 用大数模拟一下即可。 //#define test #incl 阅读全文
posted @ 2018-09-19 12:21 LMissher 阅读(167) 评论(0) 推荐(0)
摘要: 给一棵树,q次询问,每次询问给连续的一个闭区间,问区间所有数的LCA是多少。 做一个dfs序,其中把dfs序最小的点和最大的点做一次LCA求出的点就是答案。 #include <bits/stdc++.h> #define lson l,mid,rt<<1 #define rson mid+1,r, 阅读全文
posted @ 2018-09-19 12:10 LMissher 阅读(129) 评论(0) 推荐(0)
摘要: 给一颗树,其中树中有一些红色的点,每个点到距离它最近的祖先红点的距离称为它的距离。 每次给一个点子集,可以选择把树中任意一个点变为红色,问怎样让子集里的点的距离最大值最小。 当只有两个点时,肯定是先找到他们的 lca 然后先判断将 lca 染红是否可以让最大的距离变小,如果有一个点的祖先红点在 lc 阅读全文
posted @ 2018-09-17 14:53 LMissher 阅读(365) 评论(0) 推荐(0)
摘要: AC自动机上搞矩阵快速幂。 #include<cstdio> #include<cstring> #include<queue> #include<algorithm> #include<map> using namespace std; const int Nmax=207; const int 阅读全文
posted @ 2018-09-16 09:41 LMissher 阅读(195) 评论(0) 推荐(0)
摘要: 一个背包dp。 //#define test #include<bits/stdc++.h> using namespace std; const int Nmax=1e4+7; const int Vmax=1e4; typedef long long ll; const ll mod=1e9+7 阅读全文
posted @ 2018-09-16 09:40 LMissher 阅读(189) 评论(0) 推荐(0)
摘要: 不知道题意,队友用java大数+二分过了? import java.util.Arrays; import java.util.Scanner; import java.io.*; import java.math.*; public class Main { static boolean chec 阅读全文
posted @ 2018-09-16 09:39 LMissher 阅读(195) 评论(0) 推荐(0)
摘要: 求一个串中出现次数在[L,R]区间里的子串一共有多少个,后缀数组用出现次数>=L的个数减去出现次数>R的个数就是答案。 //#define test #include<bits/stdc++.h> using namespace std; const int Nmax=250007; const i 阅读全文
posted @ 2018-09-16 09:37 LMissher 阅读(243) 评论(0) 推荐(0)
摘要: water #include <bits/stdc++.h> using namespace std; int n,a,b,c; int main(){ while(~scanf("%d%d%d",&a,&b,&c)){ int ans=a*b*c; if(ans%2==0) printf("Yes 阅读全文
posted @ 2018-09-16 09:37 LMissher 阅读(131) 评论(0) 推荐(0)
摘要: 欧拉降幂求(A^B)%C,其中B超大。 //#define test #include<bits/stdc++.h> using namespace std; const int Nmax=1e6+7; typedef long long ll; const ll mod = 1e9+7; char 阅读全文
posted @ 2018-09-16 09:34 LMissher 阅读(154) 评论(0) 推荐(0)
摘要: 区间k覆盖费用流模板题。 离散化后让每个数字最多可用k次即可,源点向起点连边,终点向汇点连边,第i个点向第i+1个点连边,容量都为k,费用为0。 对于给的左闭右开区间,区间左端点向右端点连边,容量为1,费用为-val。 #include <bits/stdc++.h> using namespace 阅读全文
posted @ 2018-09-16 09:32 LMissher 阅读(166) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 ··· 14 下一页