## Little Elephant and Lemonade : CodeChef Problem LELEMON

Problem Statement:

When Little Elephant visits any room, he finds the bottle of the lemonade in that room that contains the greatest number of litres of lemonade and drinks it all.

There are n rooms (numbered from 0 to n-1), each contains $C_i$ bottles. Each bottle has a volume (in litres). The first room visited by Little Elephant was $P_0$th, the second $P_1$th, …, the m-th $P_{m-1}$th room. Note that Little Elephant may visit a room more than once.

Find for Little Elephant the total volume of lemonade he has drunk.

## Splitting Candies : CodeChef Problem SPCANDY

Problem Statement:
Cyael is a teacher at a very famous school in Byteland and she is known by her students for being very polite to them and also to encourage them to get good marks on their tests.

Then, if they get good marks she will reward them with candies 🙂 However, she knows they are all very good at Mathematics, so she decided to split the candies evenly to all the students she considers worth of receiving them, so they don’t fight with each other.

She has a bag which initially contains N candies and she intends to split the candies evenly to K students. To do this she will proceed as follows: while she has more than K candies she will give exactly 1 candy to each student until she has less than K candies. On this situation, as she can’t split candies equally among all students she will keep the remaining candies to herself.

Your job is to tell how many candies will each student and the teacher
receive after the splitting is performed.

## Special Pythagorean triplet: Project Euler Problem 9

Problem Statement:
A Pythagorean triplet is a set of three natural numbers, $a, for which,
$a^2+b^2=c^2$.

For example, $3^2+4^2=9+16=25=5^2$.

There exists exactly one Pythagorean triplet for which a + b + c = 1000.
Find the product abc.

## Summation of primes: Project Euler Problem 10

Problem Statement:
The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.
Find the sum of all the primes below two million.

## Unfriendly Numbers: Hackerrank

Problem Statement:
There is one friendly number and N unfriendly numbers. We want to find how many numbers are there which exactly divide the friendly number, but does not divide any of the unfriendly numbers.

## 2’s complement : Hackerrank

Problem Statement:
One of the basics of Computer Science is knowing how numbers are represented in 2’s complement. Imagine that you write down all numbers between A and B inclusive in 2’s complement representation using 32 bits. How many 1’s will you write down in all ?
$n!$ means $n\times(n-1)\times...\times2\times1$
For example, $10! = 10 \times 9 \times ... \times 3 \times 2 \times 1 = 3628800$,
and the sum of the digits in the number 10! is $3 + 6 + 2 + 8 + 8 + 0 + 0 = 27$.