A - Gravity Flip
Problem Link: [Codeforces 405A##link##]
- [tab]
- C++
#include<iostream> #include<bits/stdc++.h> using namespace std; int main() { int a; cin>>a; int arr[a]; for(int i=0; i<a; i++) { cin>>arr[i]; } sort(arr,arr+a); for(int i=0; i<a; i++) { cout<<arr[i]<<" "; } return 0; }
- Python3
x = int(input()) li = list(map(int,input().split())) li.sort() for i in li: print(i,end = " ")
- JAVA
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n=sc.nextInt(); int[] a=new int[n]; for(int i=0;i<n;i++) a[i]=sc.nextInt(); Arrays.sort(a); for(int i=0;i<n;i++) System.out.print(a[i]+ " "); } }