Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package javaapplication1;
- /**
- *
- * @author Cipher
- 0
- */
- import java.util.*;
- import java.lang.Math;
- public class JavaApplication1 {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- int t = scan.nextInt();
- for (int i = 0; i < t; i++) {
- int a = scan.nextInt();
- int b = scan.nextInt();
- int n = scan.nextInt();
- int sum;
- for (int j = 0; j < n; j++) {
- sum = a;
- for (int k = 0; k <=j; k++) {
- sum += (JavaApplication1.pow(2, k)* b);
- // System.out.print(sum + " ");
- }
- System.out.print(sum + " ");
- }
- }
- }
- public static int pow(int n,int p)
- {
- int mul=1,i;
- for(i=1;i<=p;i++)
- {
- mul*=n;
- }
- return mul;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement