정렬 문제 Java

983 단어
package zhuzhuangtu;

import java.util.*;
import java.io.*;
public class Main{
    
    public static void main(String rgs[]) throws Exception
    {
        BufferedReader br = 
            new BufferedReader(
                new InputStreamReader(System.in));
        int i,k=1,n;
        while(true){
            String line = br.readLine();
            n = Integer.parseInt(line);
            if(n==0)
                break;
            String[] s=new String[n+1];
            for(i=1;i<=n;i++){
                line = br.readLine();
                if(i%2!=0)
                    s[(i+1)/2]=line;
                else
                    s[n+1-i/2]=line;
            }
           
            for(i=1;i<=n;i++)
                System.out.println(s[i]);
          
        }
    }
}

좋은 웹페이지 즐겨찾기