목록PS (162)
정화 코딩

EDOC 과제를 다 풀고 추가로 푸는 문제들을 꾸준히 문제 풀기 글로 따로 정리하려고 한다. 1/14. 덩치 (백준 7568번) https://www.acmicpc.net/problem/7568 #python from sys import stdin n = int(stdin.readline()) data = [] ans = [] for _ in range(n): x, y = map(int, stdin.readline().split()) data.append([x, y]) for i in range(n): k = 1 for j in range(n): if (data[j][0] > data[i][0]) and (data[j][1] > data[i][1]): k += 1 ans.append(k) for x in..

9/18. 균형잡힌 세상 (백준 4949번) https://www.acmicpc.net/problem/4949 #python from sys import stdin class Stack : def __init__(self) : self.items = [] def push(self, item) : self.items.append(item) def pop(self) : if not self.isEmpty() : return self.items.pop() else : return -1 def peek(self) : if not self.isEmpty() : return self.items[-1] else : return -1 def isEmpty(self) : return not self.items def s..

9/11. 나이순 정렬 (백준 10814번) https://www.acmicpc.net/problem/10814 #python from sys import stdin n = int(stdin.readline()) data = [] for i in range(0, n): num, name = map(str, stdin.readline().split()) data.append([]) data[i].append(int(num)) data[i].append(name) data.sort(key=lambda x:x[0]) for i in range(0, n): print(data[i][0], data[i][1], sep=" ") 처음에는 딕셔너리로 데이터를 받고 딕셔너리 정렬을 해서 풀려고 했다. data[나이] ..

전부 파이썬으로 풀었고 다 푸는 데에 40-50분 정도 걸렸다. C문제를 다른 방법으로 푸느라 20-30분 정도 더 썼다. A. 사칙연산 (백준 10869번) https://www.acmicpc.net/problem/10869 import sys a, b = map(int, sys.stdin.readline().split()) print(a+b) print(a-b) print(a*b) print(a//b) print(a%b) (정답) B. 나머지 (백준 10430번) https://www.acmicpc.net/problem/10430 import sys a, b, c = map(int, sys.stdin.readline().split()) print((a+b)%c) print(((a%c)+(b%c))%c..

9/1. 이항 계수 1 (백준 11050번) https://www.acmicpc.net/problem/11050 #python import sys def fact(num) : ans = 1 for i in range(1, num+1) : ans *= i return ans n, k = map(int, sys.stdin.readline().split()) ans = fact(n) / (fact(k) * fact(n-k)) print(int(ans)) 저번에 풀었던 문제이지만 저번에 풀 때는 함수를 만들어서 하지 않았기 때문에, 이번에는 함수를 만들어서 활용하는 방법으로 풀어봤다. (정답) 9/3. 카드2 (백준 2164번) https://www.acmicpc.net/problem/2164 #python i..

EDOC 코딩테스트 전날인 오늘, 코딩테스트 예비소집에 있는 문제들을 풀었다. 전부 파이썬으로 풀었고, 총 1시간 20분 걸렸다. A. A+B (백준 1000번) https://www.acmicpc.net/problem/1000 import sys a, b = map(int, sys.stdin.readline().split()) print(a+b) (정답) B. 꼬마 정민 (백준 11382번) https://www.acmicpc.net/problem/11382 import sys a, b, c = map(int, sys.stdin.readline().split()) print(a+b+c) (정답) C. 단어 길이 재기 (백준 2743번) https://www.acmicpc.net/problem/2743 ..

깃허브에 코딩 문제 풀기용 레포지토리를 만들었다. 깃허브에 올리는 연습을 하기 위해... 후후 깃헙과 친해질거다!! 8/28. 직각삼각형 (백준 4153번) https://www.acmicpc.net/problem/4153 #python import sys while True : a, b, c = map(int, sys.stdin.readline().split()) if a + b + c == 0 : exit() max = c if a > max : max = a if b > max : max = b if a*a + b*b + c*c == max*max*2 : print("right") else : print("wrong") (정답) 8/28. 블랙잭 (백준 2798번) https://www.acmicp..

8/21. 벌집 (백준 2292번) https://www.acmicpc.net/problem/2292 #python n = int(input()) count = 1 num = 1 while n > num : num += count * 6 count += 1 print(count) 헷갈려서 이런 식으로 그려가면서 규칙을 찾았다. 각 줄에서 최대인 수는 1, 7, 19, 37, 61인데, 공차가 6, 12, 18 이런 식으로 6의 배수였다. (정답) 8/21. 괄호 (백준 9012번) https://www.acmicpc.net/problem/9012 #python import sys num = int(sys.stdin.readline()) count = 0 while count < num : data = s..