摘要: 开两个数组:to[i][j]表示从i这个位置向下的第2j个圆盘是哪个,f[i][j]表示流满从i这个位置向下的 2j 个圆盘需要多少体积的水。 详情见代码: 1 #include<bits/stdc++.h> 2 using namespace std; 3 const int N=1e5+10; 阅读全文
posted @ 2022-04-22 21:55 YHXo 阅读(49) 评论(0) 推荐(0)
摘要: 维护区间最值的模板题。 1.树状数组 1 #include<bits/stdc++.h> 2 //树状数组做法 3 using namespace std; 4 const int N=5e4+10; 5 int m,ma[N],mi[N],n,c[N]; 6 7 int lowbit(int x) 阅读全文
posted @ 2022-04-22 20:19 YHXo 阅读(27) 评论(0) 推荐(0)
摘要: 有两个问题:求位数和求后500位的数。 求位数:最后减去1对答案的位数是不影响的,就是求2p的位数,直接有公式log10(2)*p+1; 求后500位的数:容易想到快速幂和高精度; 1 #include<bits/stdc++.h> 2 using namespace std; 3 int p,f[ 阅读全文
posted @ 2022-04-22 19:03 YHXo 阅读(56) 评论(0) 推荐(0)
摘要: 对于a[],b[]两个数组,我们应选取其中一个为基准,再运用树状数组求逆序对的方法就行了。 大佬博客:https://www.cnblogs.com/luckyblock/p/11482130.html #include<bits/stdc++.h> using namespace std; typ 阅读全文
posted @ 2022-04-22 17:34 YHXo 阅读(29) 评论(0) 推荐(0)
摘要: 模板题,树状数组加上离散化求逆序对。 1 #include<bits/stdc++.h> 2 using namespace std; 3 typedef long long LL; 4 const int N=5e5+10; 5 int n,a[N],b[N],c[N]; 6 LL ans; 7 阅读全文
posted @ 2022-04-22 15:54 YHXo 阅读(41) 评论(0) 推荐(0)