ZZEZ73's blog

By ZZEZ73, history, 4 years ago, In English

i am having a hard time making a code that find the the minimum sum of a matrix. But the catch is that you can only choose one from each row. example input would be :

3
1 8 5
9 2 5
10 7 6

and the output being:

9 10 12.

explanation would be that INT N is given and it makes a matrix of N*N and you must make a program that find the lowest sum of elements of a row. 9=1+2+6 10=1+2+7 12=1+5+6 I tried to brute force it by finding the sum of all the sums but that turned out to be a huge bust. Could any of you help me find a way to find this code because I am stumped.

Full text and comments »

  • Vote: I like it
  • +11
  • Vote: I do not like it