Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MUST SOLVE IN JAVA Monocarp is playing a MMORPG. There are two commonly used types of currency in this MMORPG - gold coins and silver

image text in transcribed

MUST SOLVE IN JAVA

Monocarp is playing a MMORPG. There are two commonly used types of currency in this MMORPG - gold coins and silver coins. Monocarp wants to buy a new weapon for his character, and that weapon costs n silver coins. Unfortunately, right now, Monocarp has no coins at all. Monocarp can earn gold coins by completing quests in the game. Each quest yields exactly one gold coin. Monocarp can also exchange coins via the in-game trading system. Monocarp has spent days analyzing the in-game economy; he came to the following conclusion: it is possible to sell one gold coin for a silver coins (i. e. Monocarp can lose one gold coin to gain a silver coins), or buy one gold coin for b silver coins (i. e. Monocarp can lose b silver coins to gain one gold coin). Now Monocarp wants to calculate the minimum number of quests that he has to complete in order to have at least n silver coins after some abuse of the in-game economy. Note that Monocarp can perform exchanges of both types (selling and buying gold coins for silver coins) any number of times. Input The first line contains one integer t(1t104) - the number of test cases. Each test case consists of one line containing three integers n,a and b(1n107;1a,b50). Output For each test case, print one integer - the minimum possible number of quests Monocarp has to complete. Examnia Note In the first test case of the example, Monocarp should complete 4 quests, and then sell 4 gold coins for 100 silver coins. In the second test case, Monocarp should complete 400000 quests, and then sell 400000 gold coins for 10 million silver coins. In the third test case, Monocarp should complete 1 quest, sell the gold coin for 50 silver coins, buy a gold coin for 48 silver coins, and then

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Programming Languages 12th International Symposium Dbpl 2009 Lyon France August 2009 Proceedings Lncs 5708

Authors: Philippa Gardner ,Floris Geerts

2009th Edition

3642037925, 978-3642037924

Students also viewed these Databases questions