結果

問題 No.490 yukiソート
ユーザー omi_UT
提出日時 2017-03-10 22:26:11
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 762 bytes
コンパイル時間 2,653 ms
コンパイル使用メモリ 78,528 KB
実行使用メモリ 60,280 KB
最終ジャッジ日時 2024-06-24 09:56:44
合計ジャッジ時間 8,267 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 2
other AC * 8 WA * 6 TLE * 1 -- * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args)throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());
		String line[] = br.readLine().split(" ");
		int[] a = new int [n];

		for (int i=0;i<n;i++){
			a[i] = Integer.parseInt(line[i]);
		}

		for(int i=0; i<2*n-3; i++){
			for(int p=0; p<n-1; p++){
				for(int q=p+1;q<n; q++){
					if(a[p] > a[q]){
						int temp = a[p];
						a[p] = a[q];
						a[q] = temp;
					}
				}
			}
		}
		// Arrays.sort(a)
		
		System.out.print(a[0]);
		for(int i=1; i<n; i++){
			System.out.print(" "+a[i]);
		}
		System.out.println();
	}
}
0