import java.io.*;import java.util.*; class Main { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); int count = Integer.parseInt(in.readLine()); String[] input = in.readLine().split(" "); final int base = Integer.parseInt(input[0]); for(int i=1; i
import java.io.*;import java.util.*; class Main { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringBuffer stringBuffer = new StringBuffer(); String[] input = in.readLine().split(" "); long first = Long.parseLong(input[0]); long second = Long.parseLong(input[1]); while(second != 0) { long temp = first; firs..
import java.io.*;import java.util.*; class Main { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String[] input = in.readLine().split(" "); long first = Long.parseLong(input[0]); long second = Long.parseLong(input[1]); long multiply = first * second; while(second != 0) { long temp = first; first = second; seco..
import java.io.*;import java.util.*; class Main { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); int count = Integer.parseInt(in.readLine()); String[] array = new String[count]; for(int i=0; i lengthOfSecond) { return 1; } else { if(lengthOfFirst == lengthOfSecond) { return o1.compareTo(o2); } else { return -1..
import java.io.*;import java.util.*; class Main { static ArrayList[] arrayList; static boolean[] isChecked; public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String[] firstLine = in.readLine().split(" "); final int numberOfVertex = Integer.parseInt(firstLine[0]); final int numberOfEdge = Integer.parseInt(firstLin..
학교에서 들은 거다! 해서 이진탐색을 응용해서 풀려고 했는데 시간초과가 난다. C++에는 K번째 수를 구하는 함수가 STL에 아예 있나보다... 퀵소트를 응용한 퀵서치 알고리즘이란게 있어서 학교에서 배운 퀵소트 코드를 일단 그대로 갖다박아서 풀었는데도 시간초과가 난다. 인터넷에 있는 소스를 그대로 Java로 고쳐쓰기만 했는데 시간초과........ 못풀었다. import java.io.*;import java.util.*; class Main { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String[] fir..
import java.io.*;import java.util.*; class Main { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); int size = Integer.parseInt(in.readLine()); long[] array = new long[size]; for(int i=0; i
import java.io.*;import java.util.*; class Main { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringBuffer stringBuffer = new StringBuffer(); int size = Integer.parseInt(in.readLine()); int[] count = new int[10001]; for(int i=0; i
import java.io.*;import java.util.*; class Data { String name; int korean; int english; int math; public Data(String name, int korean, int english, int math) { this.name = name; this.korean = korean; this.english = english; this.math = math; }} class Main { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); int co..
import java.io.*;import java.util.*; class Data { int id; int age; String name; public Data(int id, int age, String name) { this.id = id; this.age = age; this.name = name; }} class Main { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); int count = Integer.parseInt(in.readLine()); ArrayList arrayList = new Array..