FJ String/* Problem Description FJ wrote some strings on the sandbox: a1= "A" a2= "ABA" a3= "Abacaba" a4= "Abacabadabacaba" ...

Source: Internet
Author: User
Import Java.util.Scanner;
		public class ABA {public static void main (string[] args) {Scanner sc=new Scanner (system.in);
		int N=sc.nextint ();
	Arraymethod (n); } public static void Arraymethod (int n) {string[] s1={"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N",
	    	"O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"};
	    	String[] s2={"A"};
	    	if (n==1) PrintArray (S2);//If input 1, direct output a else{for (int i=2;i<=n;i++) {S2=method (s2,s1[i-1]);
	    	} printArray (S2); }} public static string[] Method (string[] s,string s2) {//Returns an array of: Both sides is an array of s, the middle is S2 string[] str=new string[s.lengt
    	H*2+1];
    	for (int i=0;i<s.length;i++) {str[i]=s[i];
    	
    	} str[s.length]=s2;
    	for (int i=0;i<s.length;i++) {str[i+s.length+1]=s[i];
    } return str; } public static void PrintArray (string[] st) {//print array, one line for each 100 lines for (int i=0;i<st.length;i++) {if (i%100==0) syste
			M.out.println ();
	System.out.print (St[i]);	}
	}

} 
First enter a number and then output the result. Scale (1-23)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.