码迷,mamicode.com
首页 >  
搜索关键字:max sum plus plus    ( 46271个结果
hdu 2546饭卡
#include #include #include int s[1050]; int dp[1050]; int cmp(const void *a,const void * b) { return *(int *)b-*(int *)a; } int maxx(int a,int b) {return a>b?a:b;} int main() { int n,i,j,sum,MA...
分类:其他好文   时间:2014-07-26 02:20:36    阅读次数:193
P89
#include main() { int n,k; float score,sum,ave; for(n=1;n<3;n++) { sum=0.0; for(k=1;k<=4;k++) {scanf("%f",&score); sum+=score; } ave=sum/4.0; printf("NO%d:%f\n",n,ave); } } sum=0.0的位置...
分类:其他好文   时间:2014-07-26 02:04:36    阅读次数:201
P90
#include #define N 4 int fun(int a[][N]) { int i,j,max=a[0][0]; for(i=0;i<2;i++) for(j=0;j<N;j++) if(max<a[i][j]) max=a[i][j]; return max; } main() { int aa[2][N]={1,2,3,4,8,43,56,12}; ...
分类:其他好文   时间:2014-07-26 02:03:56    阅读次数:162
hdu 1248 寒冰王座
代码如下: #include #include int dp[10000]; int max(int a,int b) {return a>b?a:b;} int main() { int w[4]; int i,j,t,n; scanf("%d",&t); w[0]=150,w[2]=200,w[3]=350; while(t--) { ...
分类:其他好文   时间:2014-07-26 01:57:36    阅读次数:251
[mock]7月25日
1. 将一个数组分成左右两部分,使得右边的某个连续子段和减去左边的某个连续字段和最小[7,8,9,|3,5,-1] sum right - sum left minimal想到左右分一刀,O(n),然后对左右分别取最大字段和算法,这样是O(n^2)。但是其实左右各扫一遍,然后记录下来就行了。int ...
分类:其他好文   时间:2014-07-26 01:50:46    阅读次数:219
[LeetCode] Minimum Path Sum
Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.N...
分类:其他好文   时间:2014-07-26 01:42:16    阅读次数:263
hdu 1286 找新朋友
http://acm.hdu.edu.cn/showproblem.php?pid=1286也是筛法,但感觉...囧...有点不真实...好吧 1 #include 2 #include 3 #define MAX 33000 4 int a[MAX]; 5 int main() 6 { 7 ...
分类:其他好文   时间:2014-07-26 01:31:07    阅读次数:222
贪心算法练习:数列极差问题
在黑板上写n个正整数排成的一个数列,进行如下操作:每次擦掉其中的两个数a和b,然后在数列里面加入一个数a*b+1,如此循环往复直到黑板上只剩下一个数,在所有按这种操作方式最后得到的数中,最大的记为max,最小的记min,则该数列的极差定义为m=max-min。输入一个正整数n,然后输入n个正整数构成...
分类:其他好文   时间:2014-07-26 01:21:07    阅读次数:1446
hdu_1003_Max Sum
Max SumTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 142281Accepted Submission(s): 33104 Proble...
分类:其他好文   时间:2014-07-26 01:13:16    阅读次数:270
hdu 1244 Max Sum Plus Plus Plus
http://acm.hdu.edu.cn/showproblem.php?pid=1244状态转移方程:dp[i][j]=max(dp[i][j-1],dp[i-1][j-a[i]]+sum[j]-sum[j-a[i]]);dp[i][j]为第i段第j个数。 1 #include 2 #incl....
分类:其他好文   时间:2014-07-26 01:10:36    阅读次数:287
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!