Search found 48 matches

by Chok
Wed Oct 19, 2005 1:57 pm
Forum: Algorithms
Topic: Help : 0/1 Knapsack Problem
Replies: 8
Views: 2448

Hi Misof,
I've something figure out. Now i want to remove repeatation and premutation, then ?

Code: Select all

int coin[3]={3,2,1};
int a[MAX+1];
v=3;
a[0]=1;
for(i=0;i<v;i++) 
{
	c=coin[i];
	for(j=c;j<=MAX;j++)
		a[j]+=a[j-c];
}
Thanks in advance.
by Chok
Wed Oct 19, 2005 1:09 pm
Forum: Algorithms
Topic: Help : 0/1 Knapsack Problem
Replies: 8
Views: 2448

Hi Misof and Sanny,
Thanks. Now its clear to me. But i'm interested to know how i do it with a 1D array? is this avoid permutation ? Thankx again.
by Chok
Tue Oct 18, 2005 11:04 pm
Forum: Algorithms
Topic: Help : 0/1 Knapsack Problem
Replies: 8
Views: 2448

Hi

Hi Sanny, Thankx for ur reply. Actually I'm not using 1D array, i used 2D array. I wrote it in my pre thread just make understand. By tha way My solution for the general case is void process(void) { int i,j; for(i=0;i<100;i++) way[i][0] = 0; for(i=0;i<10;i++) way[0][i] = 1; for(i=1;i<100;i++) { for(...
by Chok
Tue Oct 18, 2005 6:39 pm
Forum: Algorithms
Topic: Help : 0/1 Knapsack Problem
Replies: 8
Views: 2448

Help : 0/1 Knapsack Problem

Hello all, I've just learned(no so good) 0/1 knapsack. With help of this, we can generate the number of ways to make S with n elements. But i'm trying to modify it where we should use each element only once for a valid result. Sometimes i got wrong result. Please help me. How i correctly modify the ...
by Chok
Wed Oct 12, 2005 6:12 pm
Forum: Algorithms
Topic: generating all possible combinations of a set
Replies: 3
Views: 1143

Hi misof,
Thankx for ur help. But if i chose r item among the sets then how can i modify it ? suppose {1,2,3,4}
i chose 2 items then
1,2
1,3
1,4
2,3
2,4
3,4 . Another things, how i get it lexographically order, i means the subset (1,3) occurs before (2,4) and so on.. Thanks again.
by Chok
Tue Oct 11, 2005 6:42 pm
Forum: Algorithms
Topic: Help Me Please: Combination with DP
Replies: 4
Views: 1670

Help Me Please: Combination with DP

Hi all, I'm very weak in dynamic programming. I want to know abt how i get all posible combination for a given set by dynamic approach. Like n=4, {1,2,3,4} If r=2, then ncr=6 1,2 1,3 1,4 2,3 2,4 3,4 If r=3 then ncr=4, i can get ncr value by general simple dp. But how can i find all possible combinat...
by Chok
Fri Sep 09, 2005 5:59 pm
Forum: Other words
Topic: UVA Online-Contests (2005) Ranklist
Replies: 2
Views: 1466

Hi avm, Nice works. But i think there are still some mistake or wrong result. Just compare with the current summery reports (though still its not updated with contest # 124 & 125). Another things, i think u sort all the contestant according to their Name, but u should sort them according to their ID...
by Chok
Sat Sep 03, 2005 8:58 pm
Forum: Volume 103 (10300-10399)
Topic: 10344 - 23 out of 5
Replies: 81
Views: 27888

Hi Jalal,
Thankx for ur help. Now i understand my mistake. Thanx again.
by Chok
Sat Sep 03, 2005 6:58 pm
Forum: Volume 103 (10300-10399)
Topic: 10344 - 23 out of 5
Replies: 81
Views: 27888

Hi Jalal,
Can you tell my error. What i miss??? Thankx in advance.
by Chok
Sun Aug 21, 2005 12:41 pm
Forum: Volume 103 (10300-10399)
Topic: 10344 - 23 out of 5
Replies: 81
Views: 27888

WA

Hi Jeff and Epsilon I'm getting WA several times. I didnt use dfs. At first i generate permutation and then check whether any of them is valid or not. Here is my code. Please help. Thankx in advance. #include<stdio.h> #include<math.h> #include<string.h> #define MAX 5 int flag,np; int a[MAX]; int b[M...
by Chok
Tue Aug 16, 2005 10:15 am
Forum: Volume 7 (700-799)
Topic: 732 - Anagrams by Stack
Replies: 17
Views: 12168

732 TLE !!!

Hi all, I'm getting tle for this problem. Here is my approach -- 1. First i check whether the frequencey of each character for two given inputs are same or not. If not same then directly print [] 2. If same, then generate all of the permutation of i's and o's. where the number of i's=o's=len of the ...
by Chok
Sun Aug 14, 2005 7:59 pm
Forum: Volume 108 (10800-10899)
Topic: 10827 - Maximum sum on a torus
Replies: 52
Views: 27849

Hi all,
Thanks Sedefcho and Shamim. I've got accepted :D with O(n^4). now i'll try it for O(n^3). Thanks again.
by Chok
Sat Aug 13, 2005 7:43 pm
Forum: Volume 108 (10800-10899)
Topic: 10827 - Maximum sum on a torus
Replies: 52
Views: 27849

Hi all, There is lots of input in this thread, but i'm confuced abt the ouput. Please anyone provide the output for those case or other input. Another thing, if i got neg value then what should i print -(neg) or 0 (zero). My idea for this problem is generate all of the combination sum by row then ge...
by Chok
Fri Jul 29, 2005 2:21 pm
Forum: Other words
Topic: Update Info & Avatar not working !!!!
Replies: 1
Views: 842

Update Info & Avatar not working !!!!

Hi all, I cant update my info at the main page, which i did it by Users Category-->>Below Register Button--> Update Info. Now its not working. I also cannot update avatar for board profile. I want to know from others that is this happen only with me ??? Or there is a problem. I dont have any complai...
by Chok
Fri Jul 29, 2005 1:50 pm
Forum: Volume 1 (100-199)
Topic: 114 - Simulation Wizardry
Replies: 80
Views: 8004

Problem 114 : Confuced !!!!

Hi all,
I'm getting confuced for the problem input/output. I've also checked for the previous thread. Please give some explanation abt the input and output. Thankx in advance.

Go to advanced search