結果

問題 No.490 yukiソート
ユーザー fjafjafja
提出日時 2017-08-31 15:04:41
言語 Java
(openjdk 23)
結果
AC  
実行時間 318 ms / 2,000 ms
コード長 489 bytes
コンパイル時間 3,850 ms
コンパイル使用メモリ 76,400 KB
実行使用メモリ 57,620 KB
最終ジャッジ日時 2024-11-06 16:34:37
合計ジャッジ時間 12,669 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder;

import java.util.Scanner;

public class N490
{
	public static void main(String[] args)
	{
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		int buf=0;
		int[] a=new int[N];
		for(int i=0;i<N;i++)
		{
			a[i]=sc.nextInt();
		}

		for(int i=0;i<2*N-3;i++)
		{
			int s=0,t=i;
			while(s<t)
			{
				if(t<=N-1&&a[s]>a[t]){buf=a[s];a[s]=a[t];a[t]=buf;}
				s++;
				t=i-s;
			}
		}
		for(int aa:a)
		{
			System.out.print(aa+" ");
		}System.out.println();

	}

}
0