Find the contiguous subarray within an array (containing at least one number) which has the largest sum.
For example, given the array [?2,1,?3,4,?1,2,1,?5,4],
the contiguous subarray [4,?1,2,1] ha...
分类:
其他好文 时间:
2014-08-05 22:37:50
阅读次数:
188
KMP查找整数数列,不是查找字符串。
原理是一样的,不过把字符串转换为数列,其他基本上是一样的。
#include
#include
const int MAX_N = 1000001;
const int MAX_M = 10001;
int strN[MAX_N], strM[MAX_M], next[MAX_M], N, M;
void getNext()
{
mems...
分类:
其他好文 时间:
2014-08-05 22:37:10
阅读次数:
194
使用向量:#include#includeusing namespace std;int FenShu(int);int main(){ double sum=0,sum1=0; for(int i=2;i a(2,1); a.reserve(3); a.at(0)=1; a.at(1)=...
分类:
其他好文 时间:
2014-08-05 22:29:40
阅读次数:
815
#includeusing namespace std;int YuanZhou(int);int main(){ int n; double temp,sum=0; cout>n; for(int i=1;i<=n;i++) { if(i%2==0) { temp=...
分类:
其他好文 时间:
2014-08-05 22:22:50
阅读次数:
209
头文件定义的符号常量CHAR_MIN char的最小值SCHAR_MAX signed char 最大值SCHAR_MIN signed char 最小值UCHAR_MAX unsigned char 最大值SHRT_MAX short 最大值SHRT_M...
分类:
其他好文 时间:
2014-08-05 22:11:40
阅读次数:
217
题意:给n个点的坐标的移动方向及速度,问在之后的时间的所有点的最大距离的最小值是多少。思路:三分。两点距离是下凹函数,它们的max也是下凹函数。可以三分。#include#include#include#include#include#include#include#include#define L...
分类:
其他好文 时间:
2014-08-05 22:01:50
阅读次数:
226
Problem Description假设一个班有n(nint main(){ int n,m,i,j,e,count,flag,a[50][5]; double aver[50],sum; //sum 必须为 double型 whil...
分类:
其他好文 时间:
2014-08-05 21:59:40
阅读次数:
226
本文我们介绍MySQL数据库表空间和索引的查看方法,并详细地给出了其代码,接下来我们一一介绍。1.查看索引(1)单位是GB SELECT CONCAT(ROUND(SUM(index_length)/(1024*1024*1024), 2), ' GB') AS 'Tot...
分类:
数据库 时间:
2014-08-05 21:51:30
阅读次数:
294
暴力啊,不要想太多
T^T g艹太坑爹了
#include
#include
#include
using namespace std;
const int MAX_N = 807;
int n;
int a[MAX_N][MAX_N], b[MAX_N][MAX_N];
int c[MAX_N][MAX_N];
int main() {
while (1 == scan...
分类:
其他好文 时间:
2014-08-05 19:24:11
阅读次数:
251
intsum=0;for(inti=10;i<=100;i++)if(i%3==0||i%5==0)sum+=i;System.out.println(sum);
分类:
其他好文 时间:
2014-08-05 19:13:11
阅读次数:
209