SHARE
TWEET

Untitled

a guest Mar 25th, 2019 58 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 = a;
  31.             for (int j = 0; j < n; j++) {
  32.                
  33.                 for (int k = 0; k <=j; k++) {
  34.  
  35.                     sum = (int) (sum + ( Math.pow(2, k) * b));
  36.                    // System.out.print(sum + " ");
  37.                 }
  38.              
  39.                 System.out.print(sum + " ");
  40.  
  41.             }
  42.  
  43.         }
  44.  
  45.     }
  46.  
  47. }
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
 
Top