Search found 209 matches

by asif_rahman0
Fri Sep 29, 2006 1:22 am
Forum: Volume 101 (10100-10199)
Topic: 10164 - Number Game
Replies: 32
Views: 10925

for both
by asif_rahman0
Fri Sep 29, 2006 1:14 am
Forum: Volume 101 (10100-10199)
Topic: 10164 - Number Game
Replies: 32
Views: 10925

minskcity wrote: 1) Do you think your algorithm would still work for the problem: given N numbers, choose K of them such that their sum is divisible by M? (N, K and M are not related).

2) Are you using the fact that M == K and N = M*2 - 1 in the actual problem statement?
YES
by asif_rahman0
Fri Sep 29, 2006 12:22 am
Forum: Volume 101 (10100-10199)
Topic: 10164 - Number Game
Replies: 32
Views: 10925

According to the problem statement : Can you choose N of them, and add them all to a integer S, to make that S/N is a integer? If there are many solutions, you can only find one of them. I do the following: Input: 4 1 2 3 4 5 6 7 Then i mod all numbers by 4. So we get 1 2 3 0 1 2 3 After this by pro...
by asif_rahman0
Thu Sep 28, 2006 8:32 pm
Forum: Volume 101 (10100-10199)
Topic: 10164 - Number Game
Replies: 32
Views: 10925

If i got wrong set of numbers then my program always return 0 otherwise return 1. if(t==n){ if(sum%n==0) return 1......find the solution else return 0.....not find the solution } And i always cache[][] every step. So i think if it again got that kind of set of numbers then it return 0. Not go to fur...
by asif_rahman0
Thu Sep 28, 2006 9:15 am
Forum: Volume 101 (10100-10199)
Topic: 10164 - Number Game
Replies: 32
Views: 10925

ok. USED is a 1-dimensional boolean array which keeps the used numbers and cache is a 2-dimensional boolean array for memoization. i memo two things. 1) sum of all numbers that i have used 2) how many numbers i have taken coz i have limit for taking. (cache returns 0 always when this combination is ...
by asif_rahman0
Thu Sep 28, 2006 1:16 am
Forum: Volume 101 (10100-10199)
Topic: 10164 - Number Game
Replies: 32
Views: 10925

I heard that it can be solved by XOR. but i dont know how ??? I solved it using simple DP. I do mod sum of number by N into every step of my recur(int sum,int t) function. May be thats the main point for acceptance. Nothing tricky. Pseudo Code: int recur(int sum,int t){ if(t==n) print those numbers ...
by asif_rahman0
Thu Sep 07, 2006 12:14 pm
Forum: Volume 105 (10500-10599)
Topic: 10505 - Montesco vs Capuleto
Replies: 73
Views: 37515

Is the following output correct? Input: 5 7 2 2 3 1 1 3 1 7 4 2 7 3 0 0 2 3 4 7 2 2 3 0 0 2 5 7 0 1 7 0 10 2 2 3 0 0 2 5 7 0 1 7 0 0 0 2 8 9 20 2 2 3 2 5 3 1 9 0 1 4 3 9 7 8 1 8 0 1 10 0 2 13 12 2 13 15 1 17 0 0 0 0 2 20 19 1 20 0 10 2 2 3 2 5 3 1 9 0 1 4 3 9 7 8 1 8 0 1 10 0 Output: 3 4 6 6 2 bye r...
by asif_rahman0
Sat Sep 02, 2006 6:09 pm
Forum: Volume 110 (11000-11099)
Topic: 11081 - Strings
Replies: 35
Views: 19721

For your input, my output is: 10 0 2 Here i explain one example for you. Ok. :) aa aa aa 1) s1[0]->s3[0] s1[1]->s3[1] so at the end of s3 return 1; s2[0]->s3[1] so at the end of s3 return 1; s2[1]->s3[1] so at the end of s3 return 1; s1[1]->s3[0] s2[0]->s3[1] so at the end of s3 return 1; s2[1]->s3[...
by asif_rahman0
Sat Sep 02, 2006 5:29 pm
Forum: Volume 110 (11000-11099)
Topic: 11081 - Strings
Replies: 35
Views: 19721

First take a string like: abc
Then compare it with third string like: abc
then ^^^^

Code: Select all

a b c
| | |
a b c
So you can check it recursively with FOR LOOP. If match(above) then go if not check the second string just the same way.
And you must count the number of return value.

Hope this will help.
by asif_rahman0
Sat Sep 02, 2006 5:07 pm
Forum: Volume 110 (11000-11099)
Topic: 11077 - Find the Permutations
Replies: 14
Views: 7168

thnx got accepted. :)
by asif_rahman0
Sat Sep 02, 2006 4:43 pm
Forum: Volume 110 (11000-11099)
Topic: 11077 - Find the Permutations
Replies: 14
Views: 7168

11077 - Find the Permutations

Plz check my input/output. Is it OK? 5 3 9 3 4 2 4 3 7 2 10 3 10 9 15 11 15 14 16 11 16 10 18 12 19 13 19 16 21 13 15 13 16 12 16 10 15 14 16 13 11 9 9 2 9 8 6 4 6 5 14 13 0 0 Output: 50 4536 11 6 175 9450 362880 310989260400 87178291200 2706813345600 1009672107080 369012649234384 7551527592063024 3...
by asif_rahman0
Fri Sep 01, 2006 5:39 am
Forum: Volume 110 (11000-11099)
Topic: 11060 - Beverages
Replies: 96
Views: 33326

May be the following two lines:

Code: Select all

.............
freopen("11060.in", "r", stdin);
freopen("11060.out", "w", stdout);
.............
bye
by asif_rahman0
Thu Aug 31, 2006 4:24 pm
Forum: Volume 109 (10900-10999)
Topic: 10912 - Simple Minded Hashing
Replies: 24
Views: 15005

thnx
by asif_rahman0
Thu Aug 31, 2006 1:27 pm
Forum: Volume 109 (10900-10999)
Topic: 10912 - Simple Minded Hashing
Replies: 24
Views: 15005

please check my input/output: 3 9 11 29 2 9 1 0 0 1 1 10 3 10 77 151 26 3 17 121 18 171 6 91 7 35 3 35 4 11 4 19 7 65 3 11 17 161 6 23 4 33 4 67 2 19 3 44 4 51 100 100 100 92 8 65 8 67 1 26 2 26 3 26 4 26 5 26 0 0 Output: Case 1: 2 Case 2: 0 Case 3: 4 Case 4: 0 Case 5: 0 Case 6: 1 Case 7: 4 Case 8: ...
by asif_rahman0
Fri Aug 25, 2006 5:33 pm
Forum: Volume 110 (11000-11099)
Topic: 11047 - The Scrooge Co Problem
Replies: 31
Views: 14228

my wish :wink:

Go to advanced search