PROBLEM LINK:
[Contest] T24
Author: Jitendra Yadav
DIFFICULTY:
SIMPLE
PROBLEM:
You are given N number of questions and K are the number of choices you get for each question. You have to find the sum of total number of players who has attempted ith question. The answer can be very large therefore, you are required to print (sum of total number of players) % 10^9+7.
EXPLANATION:
Suppose you are given 3 questions and each question has 3 choices. So, you need to find the players for each question. For 1st question, 3^3=27 (there are 3 choices each for 3 questions) players played then for 2nd question, 3^2 = 9 (there are 3 choices each for 2 questions left) players played and finally for 3rd question, 3^1 = 3 (there are 3 choices each for 1 question left) players played.
So, the sum of total players played is 27+9+3=39.
Now you need to calculate the following operation i.e. 39%10^9+7 which will give you 39 as the output.
AUTHOR’S SOLUTIONS:
Author’s solution can be found here