結果
問題 | No.490 yukiソート |
ユーザー |
![]() |
提出日時 | 2017-03-10 22:38:17 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 174 ms / 2,000 ms |
コード長 | 722 bytes |
コンパイル時間 | 2,370 ms |
コンパイル使用メモリ | 78,340 KB |
実行使用メモリ | 54,232 KB |
最終ジャッジ日時 | 2024-06-24 10:07:20 |
合計ジャッジ時間 | 7,193 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 34 |
ソースコード
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; 2*p<i; p++){if(i-p<n){if(a[p] > a[i-p]){int temp = a[p];a[p] = a[i-p];a[i-p] = temp;}}}}System.out.print(a[0]);for(int i=1; i<n; i++){System.out.print(" "+a[i]);}System.out.println();}}