Trailing Zeroes in Factorial of a Number – FCTRL – SPOJ

Now we can approach it in 2 ways – the first approach is to calculate factorial of a number and then calculate the number of trailing zeros from the result. But for any value greater than 12 we will see integer exceed. So let’s go with the second approach and Find a relation between number and…

Read more...

SPOJ – FCTRL – Factorial

The most important part of a GSM network is so called Base Transceiver Station (BTS). These transceivers form the areas called cells (this term gave the name to the cellular phone) and every phone connects to the BTS with the strongest signal (in a little-simplified view). Of course, BTSes need some attention and technicians need…

Read more...

SPOJ: PT07Y – Is it a tree

PT07Y – Is it a tree #dfs   You are given an unweighted, undirected graph. Write a program to check if it’s a tree topology. Input The first line of the input file contains two integers N and M — number of nodes and number of edges in the graph (0 < N <= 10000,…

Read more...
Bitnami