码迷,mamicode.com
首页 >  
搜索关键字:c++ memset    ( 3691个结果
SCU 4444 Travel
$BFS$。 如果$1$和$n$之间存在一条长度为$b$的边,那么还需要去计算只走长度为$a$的边的最小时间。 如果$1$和$n$之间存在一条长度为$a$的边,那么还需要去计算只走长度为$b$的边的最小时间。 第一种情况直接$BFS$即可。 第二种情况需要反过来思考,因为补图的边太多了,对于$BFS ...
分类:其他好文   时间:2017-03-30 20:43:02    阅读次数:206
toj 部分题
//////2010 #include #include #include using namespace std; mapm; bool Prime[10007]; int P[10005],n; const int maxn=10000; int main() { n=0; memset(Pri... ...
分类:其他好文   时间:2017-03-30 16:06:38    阅读次数:282
POJ 1743 Musical Theme
Description 一个数列求对应差相等最长的一段。\(n\leqslant 2\times 10^4\) Solution 后缀数组+二分。 将数列差分一下,一段字符串在\(height\)数组上一定是连续的一段,二分一个答案,找到一段\(>=mid\)的区间,然后记录一下最大最小值。 因为\ ...
分类:其他好文   时间:2017-03-30 15:30:13    阅读次数:210
openjudge-2的100次方阶乘
#include <stdio.h> #include <string.h>int main(){ int n; scanf("%d",&n); if(n==0) printf("1"); int sun[100]; memset(sun,0,sizeof(sun)); sun[99]=1; whi ...
分类:其他好文   时间:2017-03-29 14:14:06    阅读次数:158
POJ 3287 ——BFS
code #include<stdio.h>#include<iostream>#include<string.h>#include<queue>using namespace std; queue <int> q; int vis[100005]; int main(){ int n,k; whi ...
分类:其他好文   时间:2017-03-29 12:51:15    阅读次数:145
POJ 3666 Making the Grade
传送门:http://poj.org/problem?id=3666 解题思路: dp[i][j]:代表第i个数以j结尾所花的代价。。那么dp[i][j]=fabs(a[i]-j)+min(dp[i-1][k])k<j; 实现代码: ...
分类:其他好文   时间:2017-03-28 21:42:10    阅读次数:195
随机数生成(主要练习数组指针的使用)
Public char *random_num() { int *a,n=8,i,j; char *p = (char *)malloc(sizeof(char)*9); memset(p,0,sizeof(p)); a = (int *)calloc(n,sizeof(int)); for (i=... ...
分类:编程语言   时间:2017-03-28 19:31:04    阅读次数:255
NBUT 1221 Intermediary
最短路,三进制状态压缩。 $dis[i][j]$表示到$i$节点,每个中介用了几次的情况下的最小花费,跑最短路即可。 ...
分类:其他好文   时间:2017-03-28 18:37:35    阅读次数:228
嵌入式程序跑飞源头定位方法
在调试嵌入式程序时经常会遇到程序"莫名其妙"的跑飞,而这类问题一般仿真是不容易找到问题源的。今天灵光一闪,我想到了一个方法可以帮助我们定位问题源,而在实际的使用后,发现这个方法的确可行,也帮助我解决了问题。 先总结一下造成嵌入式程序跑飞的原因: 1. 内存操作错误,如alloc/memset/mem ...
分类:其他好文   时间:2017-03-27 21:03:40    阅读次数:170
CSUOJ 1854 Refrigerator Magnets
1854: Refrigerator Magnets Submit Page Summary Time Limit: 2 Sec Memory Limit: 256 Mb Submitted: 96 Solved: 23 Description Like many families with sma ...
分类:Web程序   时间:2017-03-27 13:18:00    阅读次数:275
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!