first player can check if sum of notes placed in the odd position are
greater than the sum of notes placed in the even position and can pick
accordingly and will always win.
On Sat, Oct 9, 2010 at 10:52 AM, Anand anandut2...@gmail.com wrote:
Yes.
http://codepad.org/2KFrv8cs
On Fri, Oct 8,
#includestdio.h
void main()
{
int x;
float t;
scanf(%f,t);
printf(%f\n,t);
x=90;
printf(%f\n,x);
{
x=1;
printf(%f\n,x);
{
x=30;
printf(%d\n,x);
http://people.csail.mit.edu/bdean/6.046/dp/
check out this lecture...
--
S.Nishaanth,
Computer Science and engineering,
IIT Madras.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
can anyone suggest how to implement Catalan numbers.. upper limit
1000,
consider modulo 1
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group,
There is a recurrence for computing the n+1st Catalan Number from the
0th through the nth Catalan Numbers. See
http://en.wikipedia.org/wiki/Catalan_number.
Something like this code fragment ought to do, assuming long long int
is 64 bits:
int CatalanNumber[1001];
int i,n;
long long int x;
hey! i am also unable to explain but one thing i got
if we use %d in place of %f,we will get the correct output.
we must use %d as x is of int data type.so thq code is itself
wrong.
or
u can change x to float data type
--
Ashutosh Tripathi
UG Student
Computer
On Oct 9, 11:51 am, Ashutosh Tripathi ashu.nit...@gmail.com wrote:
hey! i am also unable to explain but one thing i got
if we use %d in place of %f,we will get the correct output.
we must use %d as x is of int data type.so the code is itself
wrong.
or
u
printf is very week to convert int to float or vice versa..
please read D. Ritchie for details.
On 10/9/10, @shu ashu.nit...@gmail.com wrote:
On Oct 9, 11:51 am, Ashutosh Tripathi ashu.nit...@gmail.com wrote:
hey! i am also unable to explain but one thing i got
if we use %d in
@Terence
Sorry, had misunderstood your solutions earlier. Your approach and
calculations both are correct and more efficient than my soln.
Initially I was not much convinced with the assumption that in the first
solution, all but last pair are in their original order. Later realized that
its
@ navin :take care of conversion from double to int.
i have submitted this solution only.
On Oct 5, 8:59 pm, navin navin.myhr...@gmail.com wrote:
@Dave k=9 only for this problem.
@Mridul:
for input
2
19423474 8
19423474 9
output:
16307490 26110976
163074908 826110976
but actual
Hi,
The implementation that you are trying to do is incorrect, this is primarly
because division is not commutative over modulous. You can check that with
simple examples. eg 111 is divisible by 3, but taking modulus with 100 we
get 11 which is not divisible by 3.
Catalan number is of the form
even solution has been rejected around 5 times,
I simply copy pasted the code for a try but still it wont work.
Code pasted at http://paste.pocoo.org/show/273254/ please help !!
On Sat, Oct 9, 2010 at 11:36 PM, Mridul Malpani malpanimri...@gmail.comwrote:
@ navin :take care of conversion from
@Gunjan: If you were referring to my implementation (it is the only
one that I see), you'll notice that I used a different recurrence, the
second formulation in the properties section of the Wikipedia page I
referenced, that starts with C_0 = 1. It only uses multiplication, and
multiplication and
Dave,
Yep sorry, i over looked the implementation, its better than mine for a all
numbers less than n :).
I hope it don't happen again.
On Sun, Oct 10, 2010 at 12:38 AM, Dave dave_and_da...@juno.com wrote:
@Gunjan: If you were referring to my implementation (it is the only
one that I see),
Just change it to
int CatalanNumber[1001];
int i,n;
long long int x;
CatalanNumber[0] = 1;
*CatalanNumber[1]=1;
for( n = 2 *; n 1000 ; ++n )
{
x = 0;
for( i = 0 ; i = n ; ++i )
x += (long long int)CatalanNumber[i] * (long long
int)CatalanNumber[n-i];
CatalanNumber[n+1] =
#includestdio.h
main()
{
char a ='c';
typedef char* charp;
const charp p=a;
p++;
}
Why p is a constant pointer ?
--
regards,
soumya prasad ukil
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send
This is a nice page, but the solution closest to this problem requires
n to be even. Using the same technique to take care of odd n cases is
messy. The solution I posted seems simpler, and its efficiency is the
same.
On Oct 9, 9:03 am, nishaanth nishaant...@gmail.com wrote:
Dear prasad
after pre-compiling the expression is like
const char* p = a, so now u can understand y its const pointer
On Sun, Oct 10, 2010 at 1:07 AM, Soumya Prasad Ukil
ukil.sou...@gmail.comwrote:
#includestdio.h
main()
{
char a ='c';
typedef char* charp;
const charp
const char * = pointer to a const integer rt?
Correct me if am wrong.
On Sun, Oct 10, 2010 at 8:31 AM, umesh kewat umesh1...@gmail.com wrote:
Dear prasad
after pre-compiling the expression is like
const char* p = a, so now u can understand y its const pointer
On Sun, Oct 10, 2010 at
@kewat,
If it is const char*, then compilation won't give error. But
it is something like char *const. But how?
On 10 October 2010 08:31, umesh kewat umesh1...@gmail.com wrote:
Dear prasad
after pre-compiling the expression is like
const char* p = a, so now u can understand y
charp is not a textual replacement of char* since it is typedef.
const charp p and
charp const p
are both equivalent to p being a constant pointer to character.
On Sun, Oct 10, 2010 at 10:19 AM, Soumya Prasad Ukil
ukil.sou...@gmail.comwrote:
@kewat,
If it is const char*, then
Design an *O(n)*-time algorithm that, given a real number *x * and a sorted
array *S* of *n * numbers, determines whether or not there exist two
elements in *S* whose sum is exactly *x *.
since array is already sorted, doing binary search for x-S[i] ,for each
element indexed at i will give a
22 matches
Mail list logo