2016年6月26日 星期日

Q11192 - Group Reverse


https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=23&problem=2133&mosmsg=Submission+received+with+ID+17580598


import java.util.Scanner;

public class test {

 public static void main(String[] args) {
  // TODO Auto-generated method stub
  Scanner scn=new Scanner(System.in);
  while(scn.hasNext()){
   int n=scn.nextInt();
   if(n==0)break;
   String str=scn.next();
   char arr[]=str.toCharArray();
   if(n==1){
    for(int i=arr.length-1;i&gt=0;i--){
     System.out.print(arr[i]);
    }
    System.out.println();
   }
   else{
    n=arr.length/n;
   for(int i =n-1;i&ltarr.length;i+=n){
    for(int j=0;j<n;j++)
     System.out.print(arr[i-j]);
   }
   System.out.println();
  }
  }

 }

}

/* 
    題目:Q10055: Hashmat the brave warrior
    作者:1010
    時間:西元 2016 年 6 月 */


困難度 ★

沒有留言:

張貼留言