Search found 38 matches

Thu Oct 12, 2006 9:52 am
Forum: Volume 102 (10200-10299)
Topic: 10219 - Find the ways !
Replies: 33
Views: 10132

What is the Range

Can anyone tell me the maximum value for n???????
Tue Sep 19, 2006 7:15 am
Forum: Volume 110 (11000-11099)
Topic: 11088 - End up with More Teams
Replies: 30
Views: 17343
Among all pairs with minimum sum of values I always take the one with minimum first element. So my code passes your test case. It fails this test case: 7 2 4 6 6 7 9 9 Your greedy would choose 9,2,9 as the first team, and wouldn't be able to make a second team. But When there are 7 persons, I know ...
Fri Sep 15, 2006 8:35 am
Forum: Volume 105 (10500-10599)
Topic: 10550 - Combination Lock
Replies: 24
Views: 20413
as soyoja wrote: Quote: The only trick of this problem is distinguish between clockwise and counter-clocwise. Counting angle for clockwise is (start point) - ( end point ) Counting angle for counter clockwise is (end point) - (start point ) i know, in above way the problem will be accecpted but i d...
Mon Aug 28, 2006 2:24 pm
Forum: Volume 110 (11000-11099)
Topic: 11061 - Playing War
Replies: 41
Views: 10491
Well, thanks. A small modification and got AC. The interesting thing is when both side has more than 3 soldiers, then the optimal way is to send most possible of them. However, the statement of the problem should be clearer.........
Wed Aug 23, 2006 2:23 pm
Forum: Volume 110 (11000-11099)
Topic: 11061 - Playing War
Replies: 41
Views: 10491
1. no it is not necessary to send 3 armies always. they are the best possible player so they both plays optimally.
Is it? But the problem statement says:
It
Tue Aug 22, 2006 1:19 pm
Forum: Volume 110 (11000-11099)
Topic: 11061 - Playing War
Replies: 41
Views: 10491
You cannot use all your army in attack. Read When attacking, at least one army must remain on the origin territory, so a player with 3 armies can only use 2 of them to attack an adjacent territory. The defense, however, can use all the available number of armies to defend, up to a maximum allowed nu...
Mon Aug 21, 2006 1:54 pm
Forum: Volume 109 (10900-10999)
Topic: 10930 - A-Sequence
Replies: 102
Views: 31332
altaf hussain(sust_2002) wrote: for( j=0 ; j < num ; j++ ) {
if( array[j] != 0 ) {
sum = num + j ;
array[ sum ]++ ;
}
}
}

}

Still problem here. Try

Code: Select all

``1 6 8 10 25``
This is not an A sequence, but your program outputs the opposite...
Mon Aug 21, 2006 12:39 pm
Forum: Volume 109 (10900-10999)
Topic: 10930 - A-Sequence
Replies: 102
Views: 31332
altaf hussain(sust_2002) wrote:
for( i = 0 ; i<n ; i++){
array[ num ]++;
for( j=0 ; j < num ; j++ ) {
if( array[j] != 0 ) {
sum = num + j ;
array[ sum ]++ ;
}
}
}
}

I think this doesn't work correctly. Try the input:

Code: Select all

``5 1 6 8 10 12``
This is an A-sequence, but what your program says?????
Mon Aug 21, 2006 12:20 pm
Forum: Volume 110 (11000-11099)
Topic: 11065 - A Gentlemen's Agreement
Replies: 19
Views: 8621
shanto86 wrote:and when the rest + colored < best i will cutoff... is there any other things?
What is best? Is it the number of elements in the largest set? But you also have to count the number of possible sets. How can you cut off?
Mon Aug 21, 2006 12:00 pm
Forum: Volume 109 (10900-10999)
Topic: 10930 - A-Sequence
Replies: 102
Views: 31332
The first thing is you should not sort the data. And 2nd thing when there is a thread containing the same problem use that thread, don't create a new one. However you haven't checked if the data are strictly increasing order. Try it...
Sun Aug 20, 2006 5:52 pm
Forum: Volume 110 (11000-11099)
Topic: 11061 - Playing War
Replies: 41
Views: 10491
I think now I understand the problem. I had some wrong idea. But now I have same kind of problem. My code outputs 172 for 100. for 171 the probability is 0.4986... Most of the outputs matches. I have used: p(m,n)=p1*p(m,n-3)+p2*(m-1,n-2)+p3*(m-2,n-1)+p4*(m-3,n) where p1=6420.0/46656.0; p2=10017.0/46...
Sat Aug 19, 2006 2:56 pm
Forum: Volume 5 (500-599)
Topic: 574 - Sum It Up
Replies: 46
Views: 13763

Re: Help On 574

Hi kodder I have found your problem.Your code fails to give the correct output to the following input. Input: 4 0 6 0 Your program terminates here while the correct output is: Sums of 4: NONE Sums of 6: NONE I don't think that is the case. Because when n==0 the program should terminate: If n = 0 it...
Sat Aug 19, 2006 12:28 pm
Forum: Volume 110 (11000-11099)
Topic: 11073 - Euler's Totient Function
Replies: 20
Views: 6593
well... in my process i had written PRIME() function which returns 0/1 according to whether it is prime or not when i need to check primality for a number > sqrt(10^9) but no one here mentioned for such process. so am i doing inefficient some where? You can use 3*10^7 size char array for flagging, ...
Sat Aug 19, 2006 8:54 am
Forum: Volume 110 (11000-11099)
Topic: 11065 - A Gentlemen's Agreement
Replies: 19
Views: 8621
Well........ I have found my mistake. A silly one. Got Ac in 6.6 secs.......
Fri Aug 18, 2006 3:37 pm
Forum: Volume 110 (11000-11099)
Topic: 11052 - Economic phone calls
Replies: 26
Views: 11259
fh wrote:I used backtracking to consider all possibilities... I'm also curious whether it can be solved using greedy?
I have used Greedy approach. The code is a bit big with some if else condition. I started from the first entry....