Advertisement
Guest User

ify

a guest
Nov 17th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1.  
  2.  
  3. package bucky;
  4.  
  5. import java.util.Scanner;
  6.  
  7.  
  8. class Apples{
  9. public static void main(String args[]){
  10. Scanner in = new Scanner(System.in);
  11.  
  12.  
  13.  
  14. int q;
  15. int a;
  16. int b;
  17. int n;
  18. int h;
  19.  
  20.  
  21. q = in.nextInt();
  22. a=in.nextInt();
  23. b =in.nextInt();
  24. n = in.nextInt();
  25. if ((q <= 500)&&(q>= 0)&&(a<=50)&&(a >= 0)&&(b<=50)&&(b>=0)&&(n>=1)&&(n<=15)) {
  26.  
  27.  
  28. for( h = 0; h < (q-1); h++){
  29. a=in.nextInt();
  30. b =in.nextInt();
  31. n = in.nextInt();
  32.  
  33.  
  34. }
  35.  
  36.  
  37. int fs = a + b;
  38.  
  39. for (h = 0; h < q; h++) {
  40. int sum = (int) (a + (Math.pow(2,0)* b));
  41. System.out.print(fs + " ");
  42.  
  43.  
  44.  
  45. for (int i = 1; i<=(n-1); i++ ){
  46.  
  47. sum+= Math.pow(2,i)*b;
  48.  
  49. System.out.print(sum + " ");
  50.  
  51.  
  52. }
  53. System.out.println();
  54. }}
  55. in.close();
  56.  
  57.  
  58. }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement