码迷,mamicode.com
首页 >  
搜索关键字:std    ( 41627个结果
std::min和自定义宏冲突解决办法
#include#include#define min(a,b)!(b<a)?a:bint main(){ int a=1,b=2; std::cout<<(std::min)(a,b); return 0; }加入一个括号,std::min就不会被宏替代了。
分类:其他好文   时间:2014-07-02 21:20:14    阅读次数:197
网络流模板
在这里我只放我的模板和一些我个人的“理解”。。最大流测试题:usaco草地排水EK:时间复杂度:O(VE^2)代码复杂度:最易代码:#include #include #include using namespace std;#define CLR(a) memset(a, 0, sizeof(a)...
分类:其他好文   时间:2014-07-02 20:54:22    阅读次数:276
UVA 10883 Supermean 上下取对数防溢出
题目链接:点击打开链接 溢出了半天,觉累不爱 #include #include using namespace std; #define ll int int main(){ ll Cas= 1, T; cin>>T; while(T--){ ll n; cin>>n; double sum = 0, a; double hehe = 0; for(ll i =...
分类:其他好文   时间:2014-07-02 09:43:47    阅读次数:201
ACM:归并排序,以及利用归并排序思想求解逆序对数!
(一)归并排序 分析: (1)划分问题:把序列分成元素个数尽量相等的两半。 (2)递归求解:把两半元素分别排序。 (3)合并问题:把两个有序表合并成一个。(每次只需要把两个序列的最小元素加以比较,删除其中的较小元素并加入合并后的新表) #include using namespace std; const int MAXN = 1000; int A[MAXN], T[MAXN]; ...
分类:其他好文   时间:2014-07-02 09:22:26    阅读次数:243
hdu 1717 小数化分数2 (数论)
点我点我点我!!! 接下来要做的就是模拟上述过程了。 静下来想一下自己要得到的信息。 然后拿出来,就可以了,模拟嘛,都是这样的。 #include #include #include #include using namespace std; char str[20]; int gcd(int a,int b) { return a%b==0?b:gc...
分类:其他好文   时间:2014-07-02 09:17:57    阅读次数:159
ACM:递归与分治,最大连续和,O(n3), O(n2), O(nlogn), O(n) 算法。
题目,求一个连续的数组,最大连续和。 (一)O(n3)算法: 利用穷举法的思想,这种方法的效率最差。 代码如下: #include #include #include #include using namespace std; const int MAXN = 1000; int A[MAXN], n; int maxsum(int *A, int n) { int beat...
分类:其他好文   时间:2014-07-02 09:15:50    阅读次数:349
POJ 3261 Milk Patterns(后缀数组)
题目大意: 求可覆盖的出现k次的子串的最大长度。 思路分析: 同样是二分答案的长度,然后扫描height判断是否成立。 #include #include #include #include #define maxn 1000005 using namespace std; int str[maxn]; int sa[maxn],t1[maxn],t2[maxn]...
分类:其他好文   时间:2014-07-02 09:02:19    阅读次数:258
UVA 11090 - Going in Cycle!!
二分+SPFA找负环 11090 - Going in Cycle!! Time limit: 3.000 seconds #include #include #include #include #include using namespace std; const double INF=1000000000.; struc...
分类:其他好文   时间:2014-07-02 08:30:41    阅读次数:216
[CentOS]如何解决gcc版本冲突?
今天碰到一个比较坑爹的问题,在centos上用yum安装编译环境,运行: yum -y install make gcc gcc-c++ kernel-devel m4 ncurses-devel openssl-devel 结果导致编译cocos2d-x出现错误: cc1plus: error: unrecognized command line option "-std=c++11"...
分类:其他好文   时间:2014-07-02 08:23:01    阅读次数:290
hdu 1071 The area 高斯消元求二次函数+辛普森积分
构造系数矩阵,高斯消元求解二次函数,然后两点式求直线函数,带入辛普森积分法无脑AC。。。 #include #include #include #include #include #include using namespace std; struct node { double x,y; }p[4]; double g[10][10]; double f1(double x) //二次...
分类:其他好文   时间:2014-07-02 07:56:59    阅读次数:313
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!