Skip to content

Instantly share code, notes, and snippets.

@takuma7
Created December 16, 2011 02:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save takuma7/1484152 to your computer and use it in GitHub Desktop.
Save takuma7/1484152 to your computer and use it in GitHub Desktop.
import java.io.*;
class Mondai18_2{
public static void main(String[] args){
try{
BufferedReader r = new BufferedReader(new FileReader("siken.txt"));
PrintWriter w = new PrintWriter(new BufferedWriter(new FileWriter(args[0])));
String[] t=r.readLine().split(" ");
int[] a = new int[t.length];
for(int i=0; i<a.length; i++){
a[i] = Integer.parseInt(t[i]);
}
java.util.Arrays.sort(a);
String s="";
for(int i=a.length-1; i>=0; i--){
s += a[i];
if(i==0){
s+="\n";
}else{
s+=" ";
}
}
w.println(s);
r.close();
w.close();
}catch(Exception e){
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment