We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Project Euler #103: Special subset sums: optimum
Project Euler #103: Special subset sums: optimum
Sort by
recency
|
12 Discussions
|
Please Login in order to post a comment
What my understanding is that we are supposed to calculate near-optimal set, NOT the optimum set. Is that correct?
Can you someone confirm it by reviewing the following outputs? Surprisingly I am not getting any TLE but Wrong Answers. My best guess is that I am messing up while taking modulo.
I don't know if it's just me, but the test cases for later problems are getting more annoying associated with minor issues of handling large numbers.
Anyway, I've got an solution for this problem. To arrive at the answer skipping the unneccessary intermediate steps, generate a list of all 's at the beginning (and this is where Python fails on the server without modulo, but not on my machine). It can be achieved easily if you observe the cases for odd and even separately.
After that, to get to the answer is just a matter of accumulating those 's. You are just one step away when you have the highest element of the answer.
Time out for all test cases in java. Time complexity of my solution is O(n) and space complexity is O(n). Any help ?
what will be value of b in this question pls
int main() { long long int a[MAX][MAX],n,i,j,k,x,temp=0,b; cin>>n; a[0][0]=0; a[1][0]=1; for(i=2;i<=n;i++) temp=i/2; b=a[i-1][temp]; { for(j=0,k=j;j
Why it is showing output as: 0 0 0 0 0 0