what's this???????

This is a discussion on what's this??????? within the C Programming forums, part of the General Programming Boards category; C(m + n, 2)==>i saw this on a test what does it mean????...

  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    28

    what's this???????

    C(m + n, 2)==>i saw this on a test what does it mean????

  2. #2
    The larch
    Join Date
    May 2006
    Posts
    3,573
    Most likely a function call. What do you find so surprising about it?
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

  3. #3
    Registered User
    Join Date
    Mar 2009
    Posts
    28
    there was no function like that

  4. #4
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    Maybe it was a macro.

  5. #5
    Registered User
    Join Date
    Mar 2009
    Posts
    28
    can explain more????

  6. #6
    Registered User
    Join Date
    Mar 2009
    Posts
    28
    for example C(100,5)=????

  7. #7
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    Macros - The C Preprocessor

    Look at the "function-like macros"

    edit: and macro arguments

  8. #8
    The larch
    Join Date
    May 2006
    Posts
    3,573
    Look for something like

    Code:
    #define C(x, y) ...
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

  9. #9
    Registered User
    Join Date
    Mar 2009
    Posts
    28
    The Question was :
    There are 100 balls which are same and 5 boxes
    in the that there will be at least 6 balls in each box.
    how many ways there can be??
    a)C(100,5)
    b)C(70,5)
    c)C(70,5)-5!
    d)2*C(70,5)
    E)C(74,4)

    note: it was a computer programming test
    Last edited by alperen1994; 04-24-2009 at 08:07 AM.

  10. #10
    Registered User
    Join Date
    Mar 2009
    Posts
    28
    Quote Originally Posted by anon View Post
    Look for something like

    Code:
    #define C(x, y) ...
    There wasn't like that

  11. #11
    Registered User
    Join Date
    Oct 2008
    Posts
    1,262
    Quote Originally Posted by alperen1994 View Post
    The Question was :
    There are 100 balls which are same and 5 boxes
    in the that there will be at least 6 balls in each box.
    how many ways there can be??
    a)C(100,5)
    b)C(70,5)
    c)C(70,5)-5!
    d)2*C(70,5)
    E)C(74,4)

    note: it was a computer programming test
    I was never good at math like this. But I WAS always good at telling the answer given a set of answers.
    See, the questions are most often generated like this: take the correct answer. Then change one or two things in the answer for every wrong answer. This is to be "smart": If you don't know one of them, you're not sure. But this can be abused.

    For instance, let's say you have a question with historic events A through E. You have to put them in the right order. Four answers could be:
    ABCDE
    ABCED
    ACBDE
    EBCDA

    Look at the first character: A's most common, so A's probably the first. Same for the rest of the characters. This way you can tell ABCDE is most likely the answer. Not using this way, however, makes it a bit harder: mix two things up, and you get the wrong answer...

    Now let's do that on your question. C has two parameters. Most of the times, the first one is 70, so that is probably correct. Identically, the second is probably 5. And most of them don't have any additional things. So B is probably correct, on my method.
    Don't use this method unless you have to guess, though...

  12. #12
    Registered User
    Join Date
    Mar 2009
    Posts
    343
    Based on the context, it's probably the choose(n,k) function, defined as how many ways you can choose n objects from a set of k total. It's calculated as n!/(k!(n-k)!).

    As with all things in life, Wikipedia knows best - Binomial coefficient - Wikipedia, the free encyclopedia

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21