This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package algorithm; | |
import java.util.*; | |
public class Kakao1 { | |
public static void main(String[] args) { | |
Scanner sc = new Scanner(System.in); | |
int n = sc.nextInt(); | |
sc.nextLine(); //flush | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package algorithm; | |
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
import java.util.regex.Matcher; | |
import java.util.regex.Pattern; | |
/** | |
* @author jack |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
def kakao1_2(user): | |
p = re.compile('[0-9]+') | |
p2 = re.compile(r"[A-Z]+#*\**") | |
f = p.findall(user) | |
f2 = p2.findall(user) | |
result = [0] * 3 | |
for i in range(3): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def baekjoon11399(length, times_to_wait_in_line): | |
times_to_wait_in_line.sort() | |
cal = sum(times_to_wait_in_line) | |
result = cal | |
for i in range(length - 1, 0, -1): | |
cal -= times_to_wait_in_line[i] | |
result += cal | |
return result | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Arrays; | |
import java.util.Scanner; | |
public class Main { | |
public static int solve(int length, int[] times_to_wait_in_line) { | |
Arrays.sort(times_to_wait_in_line); | |
int cal = Arrays.stream(times_to_wait_in_line) | |
.reduce((a, b) -> a + b) | |
.getAsInt(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def f(n, a, b): | |
d = [0] * n | |
dd = [0] * n | |
a_start_position = a.index(1) | |
for i in range(n): | |
j = a_start_position + i # | |
d[i] = a[j % n] - a[(j + 1) % n] # ํ์ฌ ๊ฐ๊ณผ ๋ค์ ๊ฐ์ ์ฐจ๋ฅผ ๊ตฌํด์ฃผ๋ ์ ํ์ | |
b_start_position = b.index(1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.FileInputStream; | |
import java.util.Arrays; | |
import java.util.Comparator; | |
import java.util.Scanner; | |
class Meeting { | |
public int start; | |
public int end; | |
public Meeting(int start, int end) { | |
this.start = start; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ์, ๋ค ๋๋ฒ ์ ๋ ฌ ํ๋ ์ด์ ๋ [1, 1], [2, 2], [1, 2], [2, 2]๊ฐ์ ๋ฐ๋ก๊ฐ ์์ | |
class Meeting: | |
def __init__(self, begin, end): | |
self.begin = begin | |
self.end = end | |
def algorithm1931(): | |
meeting_list = [] | |
for x in range(int(input())): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fibo_bottom_up(n): | |
d = [0] * (n+1) | |
d[0] = 0 | |
d[1] = 1 | |
for i in range(2, n+1): | |
d[i] = d[i-1] + d[i-2] | |
return d[n] | |
def fibo(n): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
๋ฌธ์ ์ ์กฐ๊ฑด์ธ n์ด 1์ด ๋ ์ ์๋, ์ต์๊ฐ์ ๊ตฌํ ์ ์๋ ๋ฐฉ๋ฒ์ | |
1. n/3 | |
2. n/2 | |
3. n-1 | |
์ด ์๋ค. | |
n์์ n/2, n/3, n-1์ ๊ฑฐ์น๋ฉด ํ์๊ฐ +1 | |
ํ๋ฒ ๊ฑฐ์น ํ ์กฐ๊ฑด์ n ๋ฒ์ ๋ฐ๋ณตํ๋ฏ๋ก | |
1 + f(n/2) ,1 + f(n/3),1 + f(n-1) | |
๋ชจ๋ ์กฐ๊ฑด์ ๊ฑฐ์น๋ฉด์ ์ต์๊ฐ์ ๊ตฌํ๋ค. | |
์ n = 10์ผ ๋ n-1์ 9๋ฒ ๊ฑฐ์ณ๊ฐ ๊ฐ๊ณผ 8๋ฒ ๊ฑฐ์ณ๊ฐ ํ n/2๋ฅผ ํ ๋ฒ ๊ฑฐ์ณ๊ฐ ๊ฐ๊ณผ ๋น๊ต ํ ๊ฐ์ด ์์ ๊ฒ์ ์ฌ์ฉํ๋ค.(์ด ๊ฒฝ์ฐ ์๋ก ๊ฐ์ผ๋ฏ๋ก ํ์ ๊ฐ์ ์ฌ์ฉํ์ง ์์) |
OlderNewer