forked from tamycova/30DaysHR
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathday5.java
More file actions
59 lines (46 loc) · 1.13 KB
/
day5.java
File metadata and controls
59 lines (46 loc) · 1.13 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import java.util.*;
import java.io.*;
import java.math.*;
import java.text.*;
class Day_5_Loop extends MyScanner {
public static void main(String args[]) throws Exception {
Day_5_Loop in = new Day_5_Loop();
int t = in.nextInt();
while (t > 0) {
int a = in.nextInt();
int b = in.nextInt();
int n = in.nextInt();
int sum = a + b;
System.out.print(sum + " ");
for (int i = 1; i < n; i++) {
sum += (Math.pow(2, i) * b);
System.out.print(sum + " ");
}
System.out.println();
t--;
}
}
}
// Scanner Class
class MyScanner {
BufferedReader br;
StringTokenizer st;
public MyScanner() {
br = new BufferedReader(new InputStreamReader(System.in));
}
public String nextToken() throws Exception {
while(st == null || !st.hasMoreElements()) {
st = new StringTokenizer(br.readLine());
}
return st.nextToken();
}
public int nextInt() throws Exception, Exception {
return Integer.parseInt(nextToken());
}
public long nextLong() throws Exception {
return Long.parseLong(nextToken());
}
public double nextDouble() throws Exception {
return Double.parseDouble(nextToken());
}
}