https://codeforces.com/contest/102/problem/B
Can someone tell me the C++ approach to this problem https://codeforces.com/contest/102/problem/B?