Skip to content

Latest commit

 

History

History

Java Loops II

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Java HackerRank

Difficulty Max Score Success Ratio
Easy 10 97.32%

We use the integers [SVG image] , [SVG image] , and [SVG image] to create the following series:

[SVG image] You are given [SVG image] queries in the form of [SVG image] , [SVG image] , and [SVG image] . For each query, print the series corresponding to the given [SVG image] , [SVG image] , and [SVG image] values as a single line of [SVG image] space-separated integers.

Input Format

The first line contains an integer, [SVG image] , denoting the number of queries.

Each line [SVG image] of the [SVG image] subsequent lines contains three space-separated integers describing the respective [SVG image] , [SVG image] , and [SVG image] values for that query.

Constraints

  • [SVG image]
  • [SVG image]
  • [SVG image] Output Format

For each query, print the corresponding series on a new line. Each series must be printed in order as a single line of [SVG image] space-separated integers.

Sample Input

2
0 2 10
5 3 5

Sample Output

2 6 14 30 62 126 254 510 1022 2046
8 14 26 50 98

Explanation

We have two queries:

  1. We use [SVG image] , [SVG image] , and [SVG image] to produce some series [SVG image] :

    • [SVG image]
    • [SVG image]
    • [SVG image]... and so on.

Once we hit [SVG image] , we print the first ten terms as a single line of space-separated integers. 2. We use [SVG image] , [SVG image] , and [SVG image] to produce some series [SVG image] :

* *[SVG image]*
* *[SVG image]*
* *[SVG image]*
* *[SVG image]*
* *[SVG image]*We then print each element of our series as a single line of space\-separated values.

💡 Hints

➡️ Approach

✅ Detailed Solution

View Solution : Java Loops II

Submissions Leaderboard Discussions Editorial
📝 My Submission 🏆 Track our position 🤔 Help from Community ✍️ Editorial