Thread: Here's a trivia question for all of you smart programmers

  1. #1
    Trivia_Question
    Guest

    Cool Here's a trivia question for all of you smart programmers

    Matching Warriors
    -------- --------

    The Kingdom of Irfrissable Polytudinous Warriors (KIPW)
    has a tournament every year between its two tribes, the
    Kay (K), and the Kaykay (KK). This consists of contests
    between individual warriors, each tribe having the same
    number, and the tribe with the most winning warriors
    wins the coveted thud cup.

    Its up to the tribe that lost last year (currently the
    K) to choose which warriors will fight each other. The
    K are using science to do this, and have derived the
    following method of determining the probability that
    warrior i will defeat warrior j. To this end the K have
    assigned scores for 6 skills to each warrior, so the
    scores for warrior i are s[i][k] for k = 0,1,2,3,4,5.
    Then the probability of warrior i defeating warrior j
    is
    I / (I + J)

    where

    I = max{I',0}
    I' = max{ s[i][k] - s[j][k] : k=0,1,2,3,4,5 }
    J = max{J',0}
    J' = max{ s[j][k] - s[i][k] : k=0,1,2,3,4,5 }

    and in the special case that I = J = 0, the probability
    is 0.5.

    It is your task to compute for K the matching of
    warriors that will give K the greatest expected number
    of victories.

    Input
    -----

    For each of several data sets:

    Line 1: The number n of warriors in each tribe,
    0 < n <= 20;
    Lines 2 .. 1+n:
    One line for each warrior of K, where the
    warriors are numbered 1 .. n in increasing
    order, and the line for warrior i contains:
    s[i][0] s[i][1] ... s[i][5]
    0 <= s[i][k] <= 10 for every i and k.
    The s[i][k] are all integers.

    Lines 2+n .. 1+2n:
    Ditto for the warriors of KK.

    The input ends with a line containing a single 0.


    Output
    ------

    One line per instance containing `Instance #:' followed
    by the KK warrior numbers matched to the warriors of
    tribe K in increasing order of the K warrior numbers.
    E.g., `2 3 1' means K warrior 1 fights KK warrior 2,
    K warrior 2 fights KK 3, K 3 fights KK 1.


    Sample Input
    ------ -----

    2
    1 0 0 0 0 0
    0 2 0 0 0 0
    0 0 1 0 0 0
    0 0 0 3 0 0
    3
    1 0 0 0 0 0
    0 2 0 0 0 0
    0 0 3 0 0 0
    0 0 2 0 0 0
    0 1 0 0 0 0
    3 0 0 0 0 0
    0


    Sample Output
    ------ ------

    Instance 1: 2 1
    Instance 2: 3 2 1




    te: 2001/10/11 19:34:13 $
    $RCSfile: warriors.txt,v $
    $Revision: 1.5 $

  2. #2
    Mayor of Awesometown Govtcheez's Avatar
    Join Date
    Aug 2001
    Location
    MI
    Posts
    8,823
    And seeing it's posted from a school, I remember another, less wordy trivia question...

    "How many message board programmers does it take to do my homework?"

  3. #3
    Cheesy Poofs! PJYelton's Avatar
    Join Date
    Sep 2002
    Location
    Boulder
    Posts
    1,728
    LOL I think its funny that he calls us smart programmers and then proceeds to think we are stupid enough to do his homework for him!

    [edit] drat you beat me cheese! [/edit]

  4. #4
    Trivia_Question
    Guest
    Originally posted by PJYelton
    LOL I think its funny that he calls us smart programmers and then proceeds to think we are stupid enough to do his homework for him!

    [edit] drat you beat me cheese! [/edit]
    It's not homework, I want to see if anyone can get this.

    Yes, Salem, you're right, and this question is the hardest of them all.

  5. #5
    Microsoft. Who? MethodMan's Avatar
    Join Date
    Mar 2002
    Posts
    1,198
    Originally posted by Govtcheez

    "How many message board programmers does it take to do my homework?"
    LMAO

    I dont know if its funnier when people bluntly say, can you do my Homework for me, or when they try to disguise it like this.
    -MethodMan-

    Your Move:Life is a game, Play it; Life is a challenge, Meet it; Life is an opportunity, capture it.

    Homepage: http://www.freewebs.com/andy_moog/home.html

  6. #6
    Microsoft. Who? MethodMan's Avatar
    Join Date
    Mar 2002
    Posts
    1,198
    Originally posted by Trivia_Question
    It's not homework, I want to see if anyone can get this.

    Yes, Salem, you're right, and this question is the hardest of them all.
    So if someone does get it, I would assume you would like to see the code on how it is done?
    -MethodMan-

    Your Move:Life is a game, Play it; Life is a challenge, Meet it; Life is an opportunity, capture it.

    Homepage: http://www.freewebs.com/andy_moog/home.html

  7. #7
    In The Light
    Join Date
    Oct 2001
    Posts
    598
    howdy,
    i swear i saw this exact question posted on cpp-home.com.

    M.R.
    I don't like you very much. Please post a lot less.
    Cheez
    *and then*
    No, I know you were joking. My point still stands.

  8. #8
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    Look through the link in this thread. You'll find this and many other problems...

    http://cboard.cprogramming.com/showt...threadid=32146
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. smart ftp question
    By axon in forum Tech Board
    Replies: 1
    Last Post: 08-07-2004, 12:22 AM
  2. c question help for adv programmers
    By hern in forum C Programming
    Replies: 8
    Last Post: 04-27-2004, 05:55 PM
  3. what does this warningmean???
    By kreyes in forum C Programming
    Replies: 5
    Last Post: 03-04-2002, 07:53 AM
  4. One question to C++ game programmers
    By incognito in forum C++ Programming
    Replies: 6
    Last Post: 12-31-2001, 11:47 AM