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..
import java.io.*;import java.util.*; class Point { int x; int y; public Point(int x, int y) { this.x = x; this.y = y; }} 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 ArrayList(); for(int i=0; i
import java.io.*;import java.util.*; class Point { int x; int y; public Point(int x, int y) { this.x = x; this.y = y; }} 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 ArrayList(); 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)); int count = Integer.parseInt(in.readLine()); int[] array = new int[count]; 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)); String[] input = in.readLine().split(" "); final int n = Integer.parseInt(input[0]); final int m = Integer.parseInt(input[1]); final int nMinusM = n - m; int countOfBoonzaTwo = 0; int countOfBoonzaFive = 0; int cou..
import java.io.*;import java.util.*; class Main { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); ArrayList arrayList = new ArrayList(); int n = Integer.parseInt(in.readLine()); for(int a=2; a
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 n = Integer.parseInt(in.readLine()); int result = 1; while(n != 0) { result *= n; n--; } System.out.println(result); }} 간단. 10! = 3628800 이므로 시간복잡도가 계승으로 나올 때는 답이 없다는 것을 알 수 있다. var n = Int(readLine()!)!var res..
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 n = Integer.parseInt(in.readLine()); for(int i=2; i*i 1) { System.out.println(n); } }} 소인수분해를 위해 소수를 구할 필요 없이 2부터 sqrt(n)까지 순회하면서 해당 수가 주어진 수를 나눌 수 없을 때까지 나눠준다.끝에 남은 숫자를 출력하여 끝을 낸다. import Foundation var n = In..
import java.io.*;import java.util.*; class Main { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); final int max = 1000000; //6부터 1000000 까지의 소수 구해두기 int[] primes = new int[max]; int count = 0; boolean[] isCleared = new boolean[max + 1]; for(int i=2; 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)); String[] input = in.readLine().split(" "); final int m = Integer.parseInt(input[0]); final int n = Integer.parseInt(input[1]); int count = 0; int[] array = new int[n + 1]; boolean[] isCleared = new boolean[n + 1]; ..