码迷,mamicode.com
首页 >  
搜索关键字:c++ memset    ( 3691个结果
奇怪的汉诺塔
题目来源:算法竞赛进阶指南 题目标签:递归,动态规划 题目链接:https://www.acwing.com/problem/content/98/ 思路:1.先用动态规划考虑三塔问题,状态转移方程为:d[ i ]=d[i - 1] * 2 + 1 (当前圆盘等于把当前圆盘上面的圆盘先移动到第二个塔 ...
分类:其他好文   时间:2020-08-09 13:09:20    阅读次数:71
poj 1469 COURSES
http://poj.org/problem?id=1469 网络流跑二分图模板题 #include<iostream> #include<cstdio> #include<queue> #include<algorithm> #include<cmath> #include<ctime> #inc ...
分类:其他好文   时间:2020-08-05 00:02:52    阅读次数:67
大数模板
struct bign { int len, s[numlen]; bign() { memset(s, 0, sizeof(s)); len = 1; } bign(int num) { *this = num; } bign(const char *num) { *this = num; } b ...
分类:其他好文   时间:2020-07-26 01:31:46    阅读次数:58
图论常见解题方法和套路
一、Dijkstra和spfa 以下示例均使用邻接表。 Dijkstra: void Dijkstra(int S) { priority_queue <pii> Q; while(!Q.empty()) Q.pop(); memset(dis, 0x7f, sizeof(dis); memset( ...
分类:其他好文   时间:2020-07-24 21:22:49    阅读次数:84
P1048 采药
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define mem(a) memset(a,0,sizeof(a)) #define sc1(a) scanf("%lld",&a) #define sc2(a, ...
分类:其他好文   时间:2020-07-23 16:24:13    阅读次数:69
PAT-T1027 Larry and Inversions (树状数组)
题意: 每次翻转一段区间,询问翻转区间后整个序列的逆序对数量。 题解: 每次翻转区间,那么翻转区间的答案就是整个序列的原始答案减去这个区间里逆序对的数量加上顺序对的数量。 统计逆序对和顺序对用树状数组做。 #include<bits/stdc++.h> using namespace std; co ...
分类:编程语言   时间:2020-07-21 23:21:03    阅读次数:88
2020 Multi-University Training Contest 1 . Fibonacci Sum 水题改编
题意很简单,就是让你求这个东西,这个时候你发现,原题???? https://blog.csdn.net/acdreamers/article/details/23039571 哦,只是原来写过的哪一题的C是1,这个是1e18. 想都不用想,直接二项式展开,求等比数列的前n项和。 你会得到第i项(一 ...
分类:其他好文   时间:2020-07-21 23:08:28    阅读次数:137
[CF1327F]AND Segments
题目 传送门 题解 考虑对于一个区间 \([l,r]\),其并值为 \(x\) 会有什么限制: 如果 \(x\) 的第 \(i\) 位为 $1$,则要求 \([l,r]\) 所有数字的第 \(i\) 位为 $1$; 如果 \(x\) 的第 \(i\) 位为 $0$,则要求 \([l,r]\) 的所有 ...
分类:其他好文   时间:2020-07-20 10:39:00    阅读次数:56
组合数学
卢卡斯定理 求组合数: 模板题:P3807 【模板】卢卡斯定理:https://www.luogu.com.cn/problem/P3807 #include<bits/stdc++.h> #define INF 0x3f3f3f3f #define DOF 0x7f7f7f7f #define e ...
分类:其他好文   时间:2020-07-18 22:59:48    阅读次数:107
Codeforces Round #656 (Div. 3)
A 根据性质,\(a,b,c\) 中的最大值一定会在 $x,y,z $ 中出现两次 #include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; int a[3]; while(t --) { memset(a ...
分类:其他好文   时间:2020-07-18 22:42:22    阅读次数:86
3691条   上一页 1 ... 3 4 5 6 7 ... 370 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!