Problem hidden
This problem was hidden by Editorial Board member probably because it has incorrect language version or invalid test data, or description of the problem is not clear.

EIUBUSOR - Bubble Sort

Hiện thực giải thuật Bubble Sort cho danh sách chứa dữ liệu kiểu số, tham khảo: Giải thuật Sorts, Generic Collection, và đoạn chương trình gợi ý bên dưới.

Input

Gồm hai dòng:

+ Dòng đầu tiên chứa số nguyên N (1<= N <= 3*10^4) là số phần tử của danh sách, và kiểu dữ liệu trong danh sách (Một trong 4 giá trị sau: int, long, double, float).

+ Dòng thứ hai gồm N số ai (-10^9 <= ai <= 10^9) có kiểu xác định ở trên.

Output

+ Danh sách N số đã được xắp xếp bằng giải thuật Bubble Sort.

Example

Input:
5 double
2.5 1.0 3.0 0.5 1.0

Output:
0.5 1.0 1.0 2.5 3.0

Gợi ý:

import java.util.Scanner;

public class EIUSESOR {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    String dataType = sc.next();
    if (dataType == "double") {
      Double[] array = new Double[N];

      bubbleSort(array);
    }
    // Your code here
  }

  static <T extends Number & Comparable<T>> void bubbleSort(T[] array) {


    // Your code here

    // Compare t[i] and T[j]: t[i].compareTo(T[j])

  }
}

 

Added by:Ha Minh Ngoc
Date:2015-02-06
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:CSHARP C++ 4.3.2 CPP JAVA
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.