Question

In: Computer Science

Misty is fond of pokemons and likes to collect pokemon cards. She has P pokemon cards...

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.

Solutions

Expert Solution

Assuming that first line will have the number of test cases followed by each line having three space separated integers P, N and D, we can get the total number of cards a day before Dth day as follows:

In python

t = int(input())
for i in range(t):
    p, n, d = map(int, input().split())
    total = p + n*(d-1)
    print(total)

In c++

#include <iostream>
using namespace std;

int main() {
    int t;
    cin >> t;
    
    for(int i=0; i<t; i++) {
        int n, p, d, total;
        cin >> p >> n >> d;
        total = p + (n*(d-1));
        cout<<total<<"\n";
    }
}

In java

import java.util.*;

public class MyClass {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        for(int i = 0; i<t; i++) {
            int p = sc.nextInt();
            int n = sc.nextInt();
            int d = sc.nextInt();
            
            int total = p + (n*(d-1));
            System.out.println(total);
        }
    }
}

Related Solutions

Misty is fond of pokemons and likes to collect pokemon cards. She has P pokemon cards...
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.
Please code in python or C++ Misty is fond of pokemons and likes to collect pokemon...
Please code in python or C++ 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...
Your goal is to collect all 80 player cards in a game. The Player cards are...
Your goal is to collect all 80 player cards in a game. The Player cards are numbered 1 through 80. High numbered cards are rarer/more valuable than lower numbered cards. Albert has a lot of money to spend and loves the game. So every day he buys a pack for $100. Inside each pack, there is a random card. The probability of getting the n-th card is c(1.05)-n, For some constant c. Albert buys his first pack on June 1st....
OK Corporation sells gift cards in various denominations. The company likes to sell these cards because...
OK Corporation sells gift cards in various denominations. The company likes to sell these cards because cash is collected immediately, but a certain percentage will never be redeemed for merchandise. On December 1, Year One, OK reported a balance in unearned revenue of $728,000 from the sale of gift cards. a. During December, OK sold an additional $578,000 in gift cards. Prepare this journal entry. b. During December, gift cards totaling $327,000 were redeemed to purchase inventory that had originally...
Lily likes to play games with integers. She has created a new game where she determines...
Lily likes to play games with integers. She has created a new game where she determines the difference between a number and its reverse. For instance, given the number 12, its reverse is 21. Their difference is 9. The number 120 reversed is 21, and their difference is 99. She decides to apply her game to decision making. She will look at a numbered range of days and will only go to a movie on a beautiful day. Given a...
Jasmine has decided that while she likes flowers, she does not like getting her hands dirty....
Jasmine has decided that while she likes flowers, she does not like getting her hands dirty. She decides to sell her interest in FG to Rose for $150,000. Assume that at the time of sale, her properly calculated tax basis in FG is $135,000. Here are some additional facts: FG has total debt outstanding of $105,000. FG is a cash basis business. FG has receivables from sales to customers of $60,000. FG has other tangible assets with a FMV of...
Janice really likes potatoes. Potatoes cost $0.50 per pound, and she has $5.00 that she could...
Janice really likes potatoes. Potatoes cost $0.50 per pound, and she has $5.00 that she could possibly spend on potatoes or other items. Suppose she feels that the first pound of potatoes is worth $1.50, the second pound is worth $1.14, the third pound is worth $1.05, and all subsequent pounds are worth $0.30. a)How many pounds of potatoes will she purchase? b) What if she only had $3.00 to spend?
Janice really likes potatoes. Potatoes cost $1.25 per pound, and she has $5.00 that she could...
Janice really likes potatoes. Potatoes cost $1.25 per pound, and she has $5.00 that she could possibly spend on potatoes or other items. Suppose she feels that the first pound of potatoes is worth $1.50, the second pound is worth $1.14, the third pound is worth $1.05, and all subsequent pounds are worth $0.30. a. How many pounds of potatoes will she purchase? b. What if she only had $2.00 to spend?
Case study Alana is entering the end-of-life stage. She often has difficulty breathing. She likes Mai...
Case study Alana is entering the end-of-life stage. She often has difficulty breathing. She likes Mai to stroke her arm and apply massage oil. One morning she whispers to Mai that she doesn’t have the energy to see her friends and extended family anymore. She asks if Mai can tell them that she loves them, but she can’t see them anymore. As Mai is helping her out of bed, Alana says, ‘I don’t think I can have a shower today’....
Alice wants to sell her Pokemon card collection on eBay. She decides to accept the first...
Alice wants to sell her Pokemon card collection on eBay. She decides to accept the first bid that exceeds 100$. Suppose that each bid that she receives is chosen uniformly at random between 0$ and 110$ (the bids are continuous, i.e., real numbers in that interval). Let X be the number of bids Alice receives (once she accepts a bid, the auction is over and she does not receive any more bids). (a)Is X discrete, continuous, or neither? (b)Find the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT