Computer Science (CS)

Computer Science (CS)/알고리즘

[백준/Java] 24265번 알고리즘 수업 - 알고리즘의 수행 시간 4

문제 풀이 정답 풀이 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); long n = Long.parseLong(br.readLine()); System.out.println((n*(n-1))/2); System.out.println(2); br.close(); } } 메모리 14212KB 시간 120ms 첫 for문..

Computer Science (CS)/알고리즘

[백준/Java] 24264번 알고리즘 수업 - 알고리즘의 수행 시간 3

문제 정답 풀이 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); long n = Long.parseLong(br.readLine()); System.out.println(n*n); System.out.println(2); br.close(); } } 메모리 14120KB 시간 124ms 이중for이고 각 for문의 크..

Computer Science (CS)/알고리즘

[백준/Java] 24263번 알고리즘 수업 - 알고리즘의 수행 시간 2

문제 정답 풀이 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); System.out.println(n); System.out.println(1); br.close(); } } 메모리 14152KB 시간 120ms 첫째 줄에는 코드 1의 수행횟수를..

Computer Science (CS)/알고리즘

[백준/Java] 24262번 알고리즘 수업 - 알고리즘의 수행 시간 1

문제 정답 풀이 import java.io.IOException; public class Main { public static void main(String[] args) throws IOException { System.out.println(1); System.out.println(0); } } 메모리 14092KB 시간 124ms 문제 이해를 못해서 구글링으로 이해했어요..ㅋㅋㅋㅋㅋㅋㅋ 입력을 하지만 출력에 사용되는 값이 아니라 코드에 따로 작성해주지 않았습니다. 출력을 두 번 하게 되는데 첫째 줄에는 코드1의 수행 횟수를 출력해줘요. MenOfPassion 알고리즘을 보면 입력받은 배열의 크기를 나누기 2한 인덱스로 배열의 값을 리턴하는데 배열의 크기는 정해진 값이기 때문에 여러 번 할 일이 없죠...

Computer Science (CS)/알고리즘

[백준/Java] 14215번 세 막대

문제 정답 풀이 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); int a = Integer.parseInt(st.nextToken()); int b = I..

Computer Science (CS)/알고리즘

[백준/Java] 5073번 삼각형과 세 변

문제 정답 풀이 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st; while(true){ st = new StringTokenizer(br.readLine()); int n1 = Integer.parseInt(st.nextT..

Computer Science (CS)/알고리즘

[백준/Java] 10101번 삼각형 외우기

문제 정답 풀이 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n1 = Integer.parseInt(br.readLine()); int n2 = Integer.parseInt(br.readLine()); int n3 = Integer.parseInt(br.readLine()); if(n1 == n2 && n..

Computer Science (CS)/알고리즘

[백준/Java] 9063번 대지

문제 정답 풀이 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st; int minX = 10001; int minY = 10001; int maxX = -10001; int maxY = -10001; int N = Intege..

Computer Science (CS)/알고리즘

[백준/Java] 15894번 수학은 체육과목 입니다

문제 정답 풀이 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); long n = Long.parseLong(br.readLine()); System.out.println(4*n); br.close(); } } 메모리 14220KB 시간 128ms 문제에 사각형을 직접 세어보니 입력의 4배로 값이 나오는 것을 알 수 있..

Computer Science (CS)/알고리즘

[백준/Java] 3009번 네 번째 점

문제 정답 풀이 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine(), " "); int x1 = Integer.parseInt(st.nextToken()); int..

eune7
'Computer Science (CS)' 카테고리의 글 목록 (2 Page)