Problem Link : http://codeforces.com/problemset/problem/230/B

This problem asks you to find positive integers that can be divided by three different positive integers.
Ideal candidates for T-Prime numbers would be numbers that is formed by power of two of an integer. This means that the number supplied by the problem must have integer square root.
However, that is not enough to ensure that it would be a T-Prime number. If the roots are not prime, the number supplied can be divided by more than 3 positive integers.
Hence the root should be prime.

Holiday Of Equality

Problem Link : http://codeforces.com/problemset/problem/758/A

This problem asks you how many burles (currency in the story) would it take so that the citizens will have same amount of money.
It is stated in the problem we can’t take money from citizens, so the only way is to increment each citizen’s money until they have the same amount ( we are not supposed to increment a citizen’s money that has the highest value among all)

It’s possible to skip using arrays to store number of money each citizen has, by simply summing the number of money each citizen has and find out how much money the richest citizen has.
Doing so will allow us to count how much money would all citizen have in total, and then we simply substract it with amount of money all citizens have at first.

New Year and Hurry

Problem link : http://codeforces.com/problemset/problem/750/A

This problem requires you to count how many problems Limak can do in 240 – k minutes.

One way I can think of is to manually count how many minutes Limak need to do 1 problem – 10 problems (t1 – t10), and then based on the time left (240 -k), find how many problems he can solve. (Answer is i where ti < 240 -k < ti+1)

Or you can always simulate them. I did simulation and everything is smooth as silk.

Pashmak and Flowers

Problem Link: http://codeforces.com/problemset/problem/459/B

This problem asks you to find how many ways you can pick 2 flowers from the flower fields. My approach was : get numbers for most beautiful and least beautiful flower, then multiply those numbers. I used map to store the numbers due to the input.

However, there was a problem: it’s possible that the input has only one kind of flower. So you’ll have to count how many ways you can pick 2 flowers using combinations ( nC2 ).

In case if you don’t know how to code combinations, or if you are too lazy, you can see it here :


Given Length and Sum of Digits…

Problem link : http://codeforces.com/problemset/problem/489/C

I’m pretty sure this one can be categorized as implementation. I simply create the largest number first, by using all the 9s on the first digits, then reverse the number to get the smallest one after substracting one from the rightmost non zero number in the largest number, and add it to the rightmost number in case if the rightmost number is zero.

There’s also a trap which I didn’t check… even if m is equal to zero it doesn’t always mean that there’s no answer (-1 -1)


Problem link : http://codeforces.com/problemset/problem/570/A

Direct Implementation, do what the problem tells you to do straight. No tricks on this one, except that indices starts from 1 , not 0.

Simply get the winner from each city, increment their final score, and finally find the candidate with highest score and lowest index ( in case if there are candidates with same final score)

This one’s pretty simple. However at first I thought I need to use [su_highlight background=”#feb0c1″]long[/su_highlight] instead of [su_highlight background=”#feb0c1″]int[/su_highlight] since the number of votes can be as high as 109. But then I realized that 109 is the highest value it can be, so [su_highlight background=”#feb0c1″]int[/su_highlight] would suffice