-
Notifications
You must be signed in to change notification settings - Fork 56
Expand file tree
/
Copy pathJava-Loops-II.java
More file actions
36 lines (34 loc) · 1011 Bytes
/
Java-Loops-II.java
File metadata and controls
36 lines (34 loc) · 1011 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
26
27
28
29
30
31
32
33
34
35
36
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
public static void main(String[] args) {
//a+20b,a+20b+21b,......,a+20b+21b+...+2n−1b
Scanner in = new Scanner(System.in);
cases = in.nextInt();
long temp;
long sum[][] = new int[cases][15];
int a[] = new int[cases] ;
int b[] = new int[cases] ;
int n[] = new int[cases] ;
for(int i = 0; i < cases; i++) {
temp = 0;
a[i] = in.nextInt();
b[i] = in.nextInt();
n[i] = in.nextInt();
temp = a[i];
for(int j = 0; j < n[i]; j++) {
temp = temp + (b[i] * Math.pow(2,j));
sum[i][j] = temp;
}
}
for(int i = 0; i < cases; i++) {
for(int i = 0; i < cases; i++) {
System.out.print(sum[i][j]);
}
System.out.println();
}
}
}