forked from alexprut/HackerRank
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSolution.java
More file actions
25 lines (23 loc) · 715 Bytes
/
Solution.java
File metadata and controls
25 lines (23 loc) · 715 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import java.util.*;
import java.io.*;
import java.lang.Math.*;
class Solution{
public static void main(String []argh){
Scanner in = new Scanner(System.in);
int t=in.nextInt();
for(int i=0;i<t;i++){
int a = in.nextInt();
int b = in.nextInt();
int n = in.nextInt();
int[] cache = new int[n];
cache[0] = (int)(a + Math.pow(2, 0) * b);
System.out.print(cache[0] + " ");
for (int j = 1; j < n; j++) {
cache[j] = cache[j-1] + (int)(Math.pow(2, j) * b);
System.out.print(cache[j] + " ");
}
System.out.print("\n");
}
in.close();
}
}