In: Computer Science
Misty is fond of pokemons and likes to collect pokemon cards. She has P pokemon cards with her at present. She wants to have a particular number of cards on the Dth day. Her friend Ash is ready to help her to achieve the number. Ash will provide her N cards daily so that a day before the Dth day, she will have the required number of Pokemon cards.
Solution:
I have solved this question in java since no programming language is specified .
Also I am afraid the question is incomplete. I kind of know this since I have already solved the same question
If you need any changes please comment
Herw is the complete question:
Question:
Misty is fond of pokemons and likes to collect pokemon cards. She has P pokemon cards with her at present. She wants to have a particular number of cards on the Dth day. Her friend Ash is ready to help her to achieve the number. Ash will provide her N cards daily so that a day before the Dth day, she will have the required number of Pokemon cards.
Example:
Misty has cards with her, P = 5
D = 6
Ash will provide her with cards daily, N = 4
Ash provides pokemon cards:
Day 1 = 4
Day 2 = 4
Day 3 = 4
Day 4 = 4
Day 5 = 4
Total cards Ash provides = 4 + 4 + 4 + 4 + 4 = 20
Total number of pokemon cards Misty has on the Dth day = 5 + 20 = 25
Misty is busy with her tournament and wants to know the total number of pokemon cards she will have on Dth day. Can you tell her?
Input Format
The first line of input consists of the number of test cases, T
The only line of each test case consists of three space-separated integers, P, N and D.
Constraints
1<= T <=100
1<= D <=100000
0 <= P, N <=100000
Program:
import java.util.Scanner;
class Pokemon {
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
//Test cases
int T=sc.nextInt();
while(T-->0)
{
int P,N,D;
//Gettting inputs for P,N,D
P=sc.nextInt();
N=sc.nextInt();
D=sc.nextInt();
//Using D-1 since a day before
int ans=N*(D-1)+P;
System.out.println(ans);
}
}
}
Screenshot of code and output: