随笔分类 - 题 / 算法
摘要:1.逃课做法 第一眼看到: 感觉有点像内啥分解只因数 然后就不会了那我写这个干什么 这时,聪明的我们就想到了打表 怎么打呢? 如图: 我们可以把它分成几个块,提前打好每个块的答案 这样,我们就用普及的算法过了提高的题 壮观的表: 822468118437,……,3289045541824037 2.
阅读全文
摘要:原来可以用分块啊 水灵灵的做法: #include <bits/stdc++.h> using namespace std; int main() { long long n,k; scanf("%lld%lld",&n,&k); long long ans=n*k; for(long long l
阅读全文
摘要:首先 Trie树: #include<bits/stdc++.h> using namespace std; int T,q,n,t[3000005][65],cnt[3000005],idx; char s[3000005]; int getnum(char x){ if(x>='A'&&x<='
阅读全文
摘要:这是rmq 半懂不懂(因为已经会线段树了) 但是!它的代码真的好短啊啊啊啊啊! #include <bits/stdc++.h> using namespace std; int dp1[500010][20],dp2[500010][20],w[1000010]; int main(){ int
阅读全文
摘要:题解 题意:题面很臭很长。大意是,有一个大小为N的环,给出M,K,D,以及N个数。我们进行K次操作,每次操作把距离当前点不超过D的累加到当前点,结果模M。 思路:因为要进行K次,每次的原则是一样的,我们可以想到用矩阵来优化,如果i能到达j,把么base[i][j]=1;则结果ans=A(base^K
阅读全文
摘要:他说:O(n^3)是过不了滴 一搜…… 6 代码和题解没有实质区别: #include<cstdio> #include<ctime> #include<cstdlib> using namespace std; int a[505][505],b[505][505],c[505][505]; in
阅读全文
摘要:先把蜂巢快递柜画出来: __ __ __ __ __/ \__/ \__/ \__/ \__ __/ \__/ \__/53\__/ \__/ \__ / \__/ \__/52\__/54\__/ \__/ \ \__/ \__/51\__/31\__/55\__/ \__/ / \__/50\_
阅读全文
摘要:原来是二分 谁对平均分贡献大选谁 界限<0.001,100次足矣 #include<iostream> #include<cstdio> #include<algorithm> #include<cstring> using namespace std; const int maxn=1010; i
阅读全文

浙公网安备 33010602011771号