码迷,mamicode.com
首页 >  
搜索关键字:std    ( 41627个结果
[HB2014 Week5] Allot 人员分配
这两天决心专门搞好网络流了 - -题解在什么瞎胡搞跟我说要连n+2和n+1容量为无穷的边…我看了下std才做的…坑死人的地方就是,需要求多次网络流,每次别忘了把流给清空了…这次是用链表所以专门写了一个clearflow过程,如果是静态链表就可以fillchar了…program allot2;typ...
分类:其他好文   时间:2014-07-14 09:48:54    阅读次数:219
hdu 2485 Destroying the bus stations 迭代加深搜索
求最少去掉几个公交站使得从s到t的最短路径大于k。迭代加深搜索。#include #include #include using namespace std;#define maxn 60#define maxm 50000int n,m,K,cnt,up;int head[maxn],pre[ma...
分类:其他好文   时间:2014-07-14 09:29:57    阅读次数:221
cocos2d-x 如何读取遍历文件夹下的所有文件 (简单明了/童少无欺)
比如我要遍历Resources/music下面所有的文件导入头文件#include #include "dirent.h"#include "unistd.h"实现代码 std::string filePath = FileUtils::getInstance()->fullPathForFi...
分类:其他好文   时间:2014-07-14 00:33:17    阅读次数:1217
poj 1088 滑雪 dp
dp[i][j]表示从i,j开始的最长路径,记忆化搜索一下。#include #include #include using namespace std;#define maxn 120int dp[maxn][maxn],map[maxn][maxn];int r,c;int dfs(int i,...
分类:其他好文   时间:2014-07-13 23:46:25    阅读次数:259
关于求出两个整形数组不同元素,要求效率最高
由于两个数组,一比较就会出现两次for循环,所以我能想到的就是组合求出现次数,这样子,就不会出现两次for循环,上代码,希望有看到的提出更好的方法 1 #include 2 using namespace std; 3 4 void printarray(int *arr, int size) .....
分类:其他好文   时间:2014-07-13 23:15:41    阅读次数:236
练习1:将一个6*6数组的第一行,第六行,主对角线和副对角线上的元素都存1,其他元素都存成-1,不需使用初始化,尽量少使用循环
暂时只想到最简单的两层循环实现,留待后看,慢慢优化: 1 #include 2 using namespace std; 3 int main() 4 { 5 int arr[6][6] = {0}; 6 7 for (int i = 0; i < 6; i++) 8 {...
分类:其他好文   时间:2014-07-13 23:03:14    阅读次数:196
5X + 2Y +Z = 50 的所有非负整数解
这种题的解题方法都差不多,不停的循环,不过如果做一下细分,效率应该可以提升很多,下面把最常规效率也最低的代码贴上,有时间再优化 1 #include 2 using namespace std; 3 int main() 4 { 5 int x, y, z; 6 7 for (x...
分类:其他好文   时间:2014-07-13 22:56:27    阅读次数:227
求字符串中某两个字符之间的字符
这个简单,留作纪念,学习之初写的:求两个A之间的字符,并打印出来: 1 #include 2 using namespace std; 3 4 int main() 5 { 6 7 const char Stra[40] = "sdfjAI Love You So Much !Ajidh...
分类:其他好文   时间:2014-07-13 22:43:25    阅读次数:203
回文数
今天看华为的上机题目中,有一道题目是判断是否是回文数,以前没有碰到过这个概念。所谓回文数即:正着念和反着念是一样的,比如787等....判断的程序如下: 1 #include 2 using namespace std; 3 int main() 4 { 5 int n,m=0,temp;...
分类:其他好文   时间:2014-07-13 12:49:17    阅读次数:210
HDU - 4734 F(x) (2013成都网络赛,数位DP)
题意:求0-B的满足 思路:数位DP,记忆化搜索 #include #include #include #include using namespace std; int A, B; int dp[20][200000]; int bit[20]; int dfs(int cur, int num, int flag) { if (cur == -1) return num ...
分类:其他好文   时间:2014-07-13 00:02:35    阅读次数:338
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!