After Elon Musk decided to make a new business idea. He found a social network called "Friends.com". It has currently N registered users. Likewise in any social network many users can be friends. Elon Musk wants the world to be as super connected as possible, so he has this new way to suggest friendship to some pairs of users. He suggests user u to have a friendship with user v if they are not friends yet and there is a user w who is friends of both of them. Note that u, v and w are different users. Elon Musk is too busy with SpaceX these days, so he hired you to develop a Python program to count out how many friendship suggestions he has to send over his social network "Friends.com". Sample Input:
After Elon Musk decided to make a new business idea. He found a social network called "Friends.com". It has currently N registered users. Likewise in any social network many users can be friends. Elon Musk wants the world to be as super connected as possible, so he has this new way to suggest friendship to some pairs of users. He suggests user u to have a friendship with user v if they are not friends yet and there is a user w who is friends of both of them. Note that u, v and w are different users. Elon Musk is too busy with SpaceX these days, so he hired you to develop a Python program to count out how many friendship suggestions he has to send over his social network "Friends.com". Sample Input:
After Elon Musk decided to make a new business idea. He found a social network called "Friends.com". It has currently N registered users. Likewise in any social network many users can be friends. Elon Musk wants the world to be as super connected as possible, so he has this new way to suggest friendship to some pairs of users. He suggests user u to have a friendship with user v if they are not friends yet and there is a user w who is friends of both of them. Note that u, v and w are different users. Elon Musk is too busy with SpaceX these days, so he hired you to develop a Python program to count out how many friendship suggestions he has to send over his social network "Friends.com". Sample Input:
After Elon Musk decided to make a new business idea. He found a social network called "Friends.com". It has currently N registered users. Likewise in any social network many users can be friends. Elon Musk wants the world to be as super connected as possible, so he has this new way to suggest friendship to some pairs of users. He suggests user u to have a friendship with user v if they are not friends yet and there is a user w who is friends of both of them. Note that u, v and w are different users. Elon Musk is too busy with SpaceX these days, so he hired you to develop a Python program to count out how many friendship suggestions he has to send over his social network "Friends.com". Sample Input: 3 0111 1000 1000 Sample Output: 2
Transcribed Image Text:After Elon Musk decided to make a new business idea. He found a social network called
"Friends.com". It has currently N registered users. Likewise in any social network many users
can be friends. Elon Musk wants the world to be as super connected as possible, so he has
this new way to suggest friendship to some pairs of users. He suggests user u to have a
friendship with user v if they are not friends yet and there is a user w who is friends of both
of them. Note that u, v and w are different users. Elon Musk is too busy with SpaceX these
days, so he hired you to develop a Python program to count out how many friendship
suggestions he has to send over his social network "Friends.com".
Sample Input:
3
0111
1000
1000
Sample Output:
2
Process by which instructions are given to a computer, software program, or application using code.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.