Friday 15 January 2016

Solution of URI 1921 :: Guilherme and His Kites


Before seeing the solution make sure that you tried enough. Don’t paste the whole code, just find out the logic. If you stuck in trouble, just inform me on comment.

/**Bismillahir Rahmanir Rahim.**/

#include <stdio.h>
int main() {

    long long int a,n;
    scanf("%lld", &n);
    a=(n*(n-3))/2;
    printf("%lld\n",a);
    return 0;
}

3 comments:

  1. how do you get this relation??

    ReplyDelete
    Replies
    1. https://en.wikipedia.org/wiki/Complete_graph
      for determining the edge in a complete bipartile graph is (n*(n-1))/2 with bordrer edge; for kites the solution will be without border edge ((n*(n-1))/2)-n here n is the number of vertices...

      Delete

Note: only a member of this blog may post a comment.