Search found 2 matches

by ilovenwd
Wed Aug 24, 2005 3:24 pm
Forum: Algorithms
Topic: Seemingly easy DP problem
Replies: 4
Views: 2372

my algorithm is O(N) I test it with O(N^2) algorithm

#include<stdio.h>
#include<stdlib.h>

const int maxN=1000000;
int a[maxN+1];

int check(int *a,int n,int p,int len)
{
int i,j,k;
for(i=1;i<n;i++) a[i]+=a[i-1];
for(i=n;i>0;i--) a[i]=a[i-1];
a[0]=0;
int le=0;
for(i=0;i<n;i++)
for(j=i;j<n;j++)
if(a[j+1]-a[i]<=p) {
if(j+1-i>le) le=j+1-i ...
by ilovenwd
Wed May 11, 2005 11:39 am
Forum: C++
Topic: Help .. How to deal with Compile Error ?
Replies: 2
Views: 1958

Help .. How to deal with Compile Error ?

I sometimes got compile error on this OJ, as I'm using VC6.0 or BCB to compile my code. I have seen someone here said tha they can see the error message,but I cann't , why ?? who can tell me how to ? When I encounter a CE,the only thing I could do is to split my code in half and seperately sumit ...

Go to advanced search