b759: 我明明就有說過= =

題目:http://zerojudge.tw/ShowProblem?problemid=b759
程式碼:

import java.util.Scanner;
public class b759 {

 public static void main(String[] args) {
  // TODO Auto-generated method stub
  Scanner sc = new Scanner(System.in);
  while(sc.hasNext()){
   int k,j;
   String X = sc.nextLine();
   char[] ch1 = new char[X.length()]; //新陣列
   char[] ch = X.toCharArray(); //把字串轉成char
   
   for(int i=0;i<X.length();i++){
       for(j=i;j<X.length();j++){
         System.out.print(ch[j]);
       }
       for(k=0;k<i;k++){
        System.out.print(ch[k]);
       }
       System.out.println();
   }
   
  }

 }

}
迴圈部分頭腦要清晰喔~~

留言

熱門文章