Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package bucky;
- import java.util.Scanner;
- class Apples{
- public static void main(String args[]){
- Scanner in = new Scanner(System.in);
- int q;
- int a;
- int b;
- int n;
- int h;
- q = in.nextInt();
- a=in.nextInt();
- b =in.nextInt();
- n = in.nextInt();
- if ((q <= 500)&&(q>= 0)&&(a<=50)&&(a >= 0)&&(b<=50)&&(b>=0)&&(n>=1)&&(n<=15)) {
- for( h = 0; h < (q-1); h++){
- a=in.nextInt();
- b =in.nextInt();
- n = in.nextInt();
- }
- int fs = a + b;
- for (h = 0; h < q; h++) {
- int sum = (int) (a + (Math.pow(2,0)* b));
- System.out.print(fs + " ");
- for (int i = 1; i<=(n-1); i++ ){
- sum+= Math.pow(2,i)*b;
- System.out.print(sum + " ");
- }
- System.out.println();
- }}
- in.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement