Skip to content

Instantly share code, notes, and snippets.

@TPAKC
Created April 17, 2015 13:32
Show Gist options
  • Save TPAKC/271fd875efc127986054 to your computer and use it in GitHub Desktop.
Save TPAKC/271fd875efc127986054 to your computer and use it in GitHub Desktop.
import java.util.Date;
import java.util.Scanner;
import java.util.TreeSet;
/**
* Created by ТРАКС on 17.04.15.
*/
public class Leks_Poryadok {
public static void main(String[] args) throws InterruptedException {
Scanner in = new Scanner(System.in);
TreeSet<String> set = new TreeSet<String>();
int n = in.nextInt();
int k = in.nextInt();
long d = new Date().getTime();
for (int i = 1; isLimit(d) && (i<=n || i<=k); i++) set.add(Integer.toString(i));
System.out.println(set.toArray()[k - 1]);
}
public static boolean isLimit(long a)
{
return new Date().getTime()-a<490;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment