fork download
  1. import java.io.BufferedReader;
  2. import java.io.InputStreamReader;
  3.  
  4. class Main
  5. {
  6. public static void main (String[] args) throws java.lang.Exception
  7. {
  8. BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
  9. String[] params1 = bufferedReader.readLine().split(" ");
  10. String s = "";
  11. char a;
  12. a = params1[0].charAt(0);
  13. float b;
  14. s += a;
  15. b = Integer.parseInt(params1[1]);
  16. System.out.println((int)(((2+3*(b-1))*b)/2));
  17. for(int i = 0;i < b;i++){
  18. for(int j=1;j<b-i;j++){
  19. System.out.print(" ");
  20. }
  21. System.out.print(s);
  22. s=a+s+a;
  23. System.out.print("\n");
  24. }
  25. }
  26. }
Success #stdin #stdout 0.05s 2184192KB
stdin
A 3
stdout
12
  A
 AAA
AAAAA