diff --git a/.gitignore b/.gitignore index 524ab92..a578246 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,13 @@ .DS_Store ._.DS_Store **/.DS_Store -**/._.DS_Store \ No newline at end of file +**/._.DS_Store + +# IntelliJ project files +.idea +.idea/*.xml +*.iml +out +gen +build +rebel.xml \ No newline at end of file diff --git "a/Beakjoon/atsunset529/week_3/\352\267\270\353\243\271\353\213\250\354\226\264\354\262\264\354\273\244.py" "b/Beakjoon/atsunset529/week_3/\352\267\270\353\243\271\353\213\250\354\226\264\354\262\264\354\273\244.py" new file mode 100644 index 0000000..e69a48f --- /dev/null +++ "b/Beakjoon/atsunset529/week_3/\352\267\270\353\243\271\353\213\250\354\226\264\354\262\264\354\273\244.py" @@ -0,0 +1,19 @@ + +### [Baekjoon-1316] 그룹단어체커 + +cnt = 0 +n = int(input()) +#words = list(map(str, input().lower().split())) + +for i in range(n): + if n < 101: + word = input() + if list(word) == sorted(word, key=word.find): #only sorted: cbac->abcc, with .find->ccba + cnt += 1 + else: + print("n < 101") + break + +print(cnt) + +#https://www.acmicpc.net/problem/1316 \ No newline at end of file diff --git "a/Beakjoon/atsunset529/week_3/\354\205\200\355\224\204_\353\204\230\353\262\204.py" "b/Beakjoon/atsunset529/week_3/\354\205\200\355\224\204_\353\204\230\353\262\204.py" new file mode 100644 index 0000000..6f10077 --- /dev/null +++ "b/Beakjoon/atsunset529/week_3/\354\205\200\355\224\204_\353\204\230\353\262\204.py" @@ -0,0 +1,17 @@ + +### [Baekjoon-4673] 셀프넘버 + + +numbers = set(range(1, 10001)) +non_selfnumbers = set() + +#n을 d(n)의 생성자라 하고 셀프넘버는 생성자가 없는 숫자 +#이때 dn은 수열; 33 + 3 + 3 = 39이고, 그 다음 수는 39 + 3 + 9 = 51 +for d_n in numbers: + for n in str(d_n): + d_n += int(n) + non_selfnumbers.add(d_n) #셀프넘버가 아닌 숫자를 집합에 추가 + +selfnum = numbers - non_selfnumbers #둘 다 집합이라 차집합 계산 +print(sorted(selfnum)) #정렬 +#https://www.acmicpc.net/problem/4673 \ No newline at end of file diff --git "a/Beakjoon/atsunset529/week_3/\354\206\214\354\210\230\354\260\276\352\270\260.py" "b/Beakjoon/atsunset529/week_3/\354\206\214\354\210\230\354\260\276\352\270\260.py" new file mode 100644 index 0000000..b36f0a8 --- /dev/null +++ "b/Beakjoon/atsunset529/week_3/\354\206\214\354\210\230\354\260\276\352\270\260.py" @@ -0,0 +1,25 @@ + +### [Baekjoon-1978] 소수찾기 + +n = int(input()) +data = list(map(int, input().split())) +prime_num = 0 + +if n == len(data): #첫줄 수의 갯수 n + + for i in data: #n개중 소수의 개수 구하기 + cnt = 0 + if(i == 1): + continue + for j in range(2, i+1): + if(i % j == 0): #2~자신의 수까지 나누어떨어지는지 + cnt += 1 + if(cnt == 1): #자신으로 나눈 하나만 나머지가 없었다면 소수 + prime_num += 1 + + print(prime_num) + +else: + print("첫번째 입력한 숫자를 확인하세요") + +#https://www.acmicpc.net/problem/1978 \ No newline at end of file diff --git "a/Programmers/atsunset529/week_1/\352\270\260\353\212\245\352\260\234\353\260\234.py" "b/Programmers/atsunset529/week_1/\352\270\260\353\212\245\352\260\234\353\260\234.py" new file mode 100644 index 0000000..e69de29 diff --git "a/Programmers/atsunset529/week_1/\354\231\204\354\243\274\355\225\230\354\247\200\353\252\273\355\225\234\354\204\240\354\210\230.py" "b/Programmers/atsunset529/week_1/\354\231\204\354\243\274\355\225\230\354\247\200\353\252\273\355\225\234\354\204\240\354\210\230.py" new file mode 100644 index 0000000..0d57d9f --- /dev/null +++ "b/Programmers/atsunset529/week_1/\354\231\204\354\243\274\355\225\230\354\247\200\353\252\273\355\225\234\354\204\240\354\210\230.py" @@ -0,0 +1,16 @@ +#[Programmers] 완주하지못한선수 + +def solution(participant, completion): + participant = sorted(participant) #['filipa', 'josipa', 'marina', 'nikola', 'vinko'] + completion = sorted(completion) #['filipa', 'josipa', 'marina', 'nikola'] + + for i in range(len(completion)): + if participant[i] != completion[i]: #예시는 지금 이경우 없음 + answer = participant[i] + return answer + + answer = participant[-1] #없으면 리스트 마지막인 vinko출력 + return answer + +#https://school.programmers.co.kr/learn/courses/30/lessons/42576?language=python3# + diff --git "a/Programmers/atsunset529/week_1/\354\240\204\355\231\224\353\262\210\355\230\270\353\252\251\353\241\235.py" "b/Programmers/atsunset529/week_1/\354\240\204\355\231\224\353\262\210\355\230\270\353\252\251\353\241\235.py" new file mode 100644 index 0000000..e78a610 --- /dev/null +++ "b/Programmers/atsunset529/week_1/\354\240\204\355\231\224\353\262\210\355\230\270\353\252\251\353\241\235.py" @@ -0,0 +1,13 @@ +#[Programmers] 전화번호목록 + +def solution(phone_book): + phone_book = sorted(phone_book) #문자로 정렬 + + for i in range(len(phone_book)): + for j in range(len(phone_book)): + if i != j and phone_book[i].startswith(phone_book[j]): #i가 j로 시작하면 false출력 + return False + + return True + +#https://school.programmers.co.kr/learn/courses/30/lessons/42577?language=python3 \ No newline at end of file diff --git a/Programmers/atsunset529/week_2/test.py b/Programmers/atsunset529/week_2/test.py new file mode 100644 index 0000000..bef572d --- /dev/null +++ b/Programmers/atsunset529/week_2/test.py @@ -0,0 +1 @@ +print("????")