码迷,mamicode.com
首页 >  
搜索关键字:arg min    ( 22495个结果
POJ 2263 Heavy Cargo(ZOJ 1952)
最短路变形或最大生成树变形。 问 目标两地之间能通过的小重量。 用最短路把初始赋为INF,其他为0.然后找 dis[v]=min(dis[u], d); 生成树就是把最大生成树找出来,直到出发和终点能沟通的时候,最小的边就是。 Kruskal: #include #include #include #include #include #include #include...
分类:其他好文   时间:2014-07-19 23:22:59    阅读次数:236
LeetCode Maximum Subarray
class Solution {public: int maxSubArray(int A[], int n) { int cur_sum = 0; int max_sum = INT_MIN; for (int i=0; i max_...
分类:其他好文   时间:2014-07-19 15:18:15    阅读次数:160
CMSIS Example - osMutex osMutexWait osMutexRelease
osMutexDef( Mutex );osMutexId mutex;void Thread0( void * arg);void Thread1( void * arg);osThreadDef( Thread0, Thread0, osPriorityNormal, 512 );osThrea...
分类:其他好文   时间:2014-07-19 15:09:35    阅读次数:387
CMSIS Example - osMessageQ osMessagePut osMessageGet
1 #include "cmsis_os.h" 2 3 void Thread0( void * arg); 4 void Thread1( void * arg); 5 6 osThreadDef( Thread0, Thread0, osPriorityNormal, 512 ); 7 o...
分类:其他好文   时间:2014-07-19 15:06:21    阅读次数:1230
acm poj1260 dp
题目大意:买珍珠,每买一种珍珠需要额外付出十个这种珍珠的钱,但你可以买比这种珍珠高品质的珍珠来替换它(那么就只需要那高品质付出那额外的十个珍珠的钱了,但是每个珍珠的价钱也变化了)这是一个dp。令dp[i]为只买前i种珍珠的最少花费钱数,状态转移方程为dp[i] = min(dp[i],dp[j]+s...
分类:其他好文   时间:2014-07-19 15:03:24    阅读次数:208
CMSIS Example - osTimer osTimerCreate osTimerStart
1 osTimerId timer; 2 3 uint32_t cnt=0; 4 void timerHandler( void * arg ) 5 { 6 cnt++; 7 osTimerStart( timer, 100 ); 8 } 9 10 osTimerDef( timer, ...
分类:其他好文   时间:2014-07-19 14:38:22    阅读次数:282
XML自定义检查器语法+约束(1)
自定义XML的检查器(语法+约束)     //创建IE内置解析器 var xmldoc = new ActiveXObject("Microsoft.XMLDOM"); //开启xml校验 xmldoc.validateOnParse="true"; //加载需要检查的XML文件 xmldoc.load("arg_entity.xml"); //正确 if(xml...
分类:其他好文   时间:2014-07-19 02:37:36    阅读次数:191
动态规划+滚动数组 -- POJ 1159 Palindrome
给一字符串,问最少加几个字符可以让它成为回文串 比如 Ab3bd 最少需要两个字符可以成为回文串 dAb3bAd 思路: 动态规划 DP[i][j] 意味着从 i 到 j 这段字符变为回文串最少要几个字符,枚举子串长。 if str[i] == str[j]: DP[i][j] = DP[i + 1][j - 1] else: DP[i][j] = min( DP[i +...
分类:其他好文   时间:2014-07-19 02:35:45    阅读次数:198
poj 3974 Palindrome
边吃边敲,效率就是高 代码如下: #include #include #define MAX 1000050 char s[MAX],ss[MAX*2]; int p[MAX*2]; int min(int a,int b){return a>b?b:a;} int main() { int i,id,mx,max,n,j; j=1; while(scanf("%s",s...
分类:其他好文   时间:2014-07-19 02:31:25    阅读次数:166
hdu 3294 Girls' research
#include #include #define MAX 200020 char s[MAX],ss[MAX*2],str[2]; int p[MAX*2]; int chance(char s) { return (s- str[0] + 26) % 26 + 'a'; } int min(int a,int b){return a>b?b:a;} int main() { ...
分类:其他好文   时间:2014-07-19 02:31:05    阅读次数:201
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!