Download as pdf
Download as pdf
You are on page 1of 2
si820:7 ‘Sx Degr 20s of Bill Gates |850x Cosing Contest 20°7 Question | Cortes | HackerRank Q tres comme ane ane tine Ed * seashore ‘All Contests > CS50x Coding Contest 2017 > Six Degrees of Bill Gates Six Degrees of Bill Gates - Boo Write a program that, given a numberof people Nas an integer, an .N.x.N. matrix of integers A, where IQ] = 1 means that people 0 and 3 have a connection and A(52] = 0 means that people 2 and 5 do not have a connection, and two integers, and ¥ representing the two people to check, pint Va standard output the number that isthe smallest number of connections to have the two people connected Ino connection is possible prin 1 For example i use inputs +3 118, 2, e1, (2, @, 4, (8, 4, @1) @ 2.yourprogram should print 2 #3 (18, 1, 81, (2, @ 4, (8, 4, 91) 2 e.yourprogram should print 2 +3 118, 1, e1, (4, &, @), (8, 8, 81) @ 2.yourprogram should print -1 You may inchide sdlitional header les as needed, and you may call any functions you'd like Note that the C550 Library's header fle must be included with double quotes fie, #include "es58.h*) instead of angled brackets because of how it's installed on HackerRank’s servers, Input Format ‘The number N willbe an integer followed by a newline, The next Nines wll be the ows of the two-dimensional aay Fach row will be comprised of N integers wth one space in between each integer {W- 1 spaces total and a newline atthe end of che row. The nex two fines will each have one integer followed by a newline, representing the people being compared Constraints <=100 Exch Afi} willbe 0 oF 1 Awill be a symmetric matric oexen oceven ‘Output Format ‘A number value as an integer, no trang newline, Sample Input Sample Output Explanation thipeuhwwn hackerrankconveartastecs60x-2017ichalenges/esS0-2016-8 we si820:7 ‘Sx Degr 20s of Bill Gates |850x Cosing Contest 20°7 Question | Cortes | HackerRank We leave the TODO to you! Current Buffer (saved locally, editable) P 2 include 5 int wain(void) eet 7 14 y000 ay ° Upload code az ile Test agsine custom input Jon us on IRC at #hackerrank on freenode for hugs or bugs f¥in Submissions: 121 Max Score: 1 Rate This Challenge: waway ~ x @ Cones calend| ntervew Prep Blog| Scoring [Environment [FAC |About Us | Support Careers| Tem Of Service|Privacy Policy [Request Feature thipeuhwwr hackerrankconvcantstecs60x-2017ichalenges/esS0-2016-8

You might also like