SHARE
TWEET

Untitled

a guest Mar 25th, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package javaapplication1;
  7.  
  8. /**
  9.  *
  10.  * @author Cipher
  11.  0
  12.  */
  13. import java.util.*;
  14. import java.lang.Math;
  15.  
  16. public class JavaApplication1 {
  17.  
  18.     /**
  19.      * @param args the command line arguments
  20.      */
  21.     public static void main(String[] args) {
  22.  
  23.         Scanner scan = new Scanner(System.in);
  24.         int t = scan.nextInt();
  25.         for (int i = 0; i < t; i++) {
  26.            
  27.             int a = scan.nextInt();
  28.             int b = scan.nextInt();
  29.             int n = scan.nextInt();
  30.              int sum;
  31.             for (int j = 0; j < n; j++) {
  32.                
  33.                 sum = a;
  34.                 for (int k = 0; k <=j; k++) {
  35.  
  36.                     sum +=  (JavaApplication1.pow(2, k)* b);
  37.                    // System.out.print(sum + " ");
  38.                 }
  39.              
  40.                 System.out.print(sum + " ");
  41.  
  42.             }
  43.  
  44.         }
  45.  
  46.     }
  47.     public static int pow(int n,int p)
  48.     {
  49.         int mul=1,i;
  50.         for(i=1;i<=p;i++)
  51.         {
  52.         mul*=n;
  53.         }
  54.        
  55.         return mul;
  56.     }
  57.  
  58. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top