728x90
반응형

프로그래밍 74

백준 25083번 문제(새싹) 파이썬(Python) 풀이 [로밍맨]

문제 링크 https://www.acmicpc.net/problem/25083 25083번: 새싹 아래 예제와 같이 새싹을 출력하시오. www.acmicpc.net 정답 코드는 아래와 같습니다. 1 2 3 4 5 6 print(" ,r\'\"7") print("r`-_ ,\' ,/") print(" \\. \". L_r\'") print(" `~\\/") print(" |") print(" |") cs 풀이는 아래 영상을 참고 바랍니다. https://www.youtube.com/watch?v=kbgfJrKQ7eU 저작권 라이선스: CC BY (출처만 표시하면 자유롭게 이용 가능)

[LeetCode] 26. Remove Duplicates from Sorted Array 파이썬(Python) 풀이

문제 링크 https://leetcode.com/problems/remove-duplicates-from-sorted-array Remove Duplicates from Sorted Array - LeetCode Can you solve this real interview question? Remove Duplicates from Sorted Array - Given an integer array nums sorted in non-decreasing order, remove the duplicates in-place [https://en.wikipedia.org/wiki/In-place_algorithm] such that each unique element ap leetcode.com 투 포인터 문제라..

[LeetCode] 27. Remove Element 파이썬(Python) 풀이

문제 링크 https://leetcode.com/problems/remove-element Remove Element - LeetCode Can you solve this real interview question? Remove Element - Given an integer array nums and an integer val, remove all occurrences of val in nums in-place [https://en.wikipedia.org/wiki/In-place_algorithm]. The order of the elements may be changed. Then r leetcode.com element 간의 순서가 변경되어도 상관 없으니, 순차적으로 방문하면서 지워야 하는 ele..

[LeetCode] 88. Merge Sorted Array 파이썬(Python) 풀이

문제 링크 https://leetcode.com/problems/merge-sorted-array Merge Sorted Array - LeetCode Can you solve this real interview question? Merge Sorted Array - You are given two integer arrays nums1 and nums2, sorted in non-decreasing order, and two integers m and n, representing the number of elements in nums1 and nums2 respectively. Merge nums1 an leetcode.com merge sort 에서 가장 핵심이 되는 merge 함수의 in-place ..

백준 2588번 문제(곱셈) 파이썬(Python) 풀이 [로밍맨]

문제 링크 https://www.acmicpc.net/problem/2588 2588번: 곱셈 첫째 줄부터 넷째 줄까지 차례대로 (3), (4), (5), (6)에 들어갈 값을 출력한다. www.acmicpc.net 정답 코드는 아래와 같습니다. 1 2 3 4 5 6 7 8 9 10 a = int(input()) b = int(input()) b0 = b % 10 b1 = (b % 100) // 10 b2 = b // 100 print(a * b0) print(a * b1) print(a * b2) print(a * b) cs 풀이는 아래 영상을 참고 바랍니다. https://www.youtube.com/watch?v=c4E8gylCyC8 저작권 라이선스: CC BY (출처만 표시하면 자유롭게 이용 가능)

백준 10430번 문제(나머지) 파이썬(Python) 풀이 [로밍맨]

문제 링크 https://www.acmicpc.net/problem/10430 10430번: 나머지 첫째 줄에 A, B, C가 순서대로 주어진다. (2 ≤ A, B, C ≤ 10000) www.acmicpc.net 정답 코드는 아래와 같습니다. 1 2 3 4 5 6 7 import sys A, B, C = map(int, sys.stdin.readline().rstrip().split()) print((A+B)%C) print(((A%C) + (B%C))%C) print((A*B)%C) print(((A%C) * (B%C))%C) Colored by Color Scripter cs 동영상에서 말씀드린 참고하실 링크는 다음과 같습니다. https://roamingman.tistory.com/27 백준 25..

백준 2263번 문제(트리의 순회) C++ 풀이 [로밍맨]

문제 링크 https://www.acmicpc.net/problem/2263 2263번: 트리의 순회 첫째 줄에 n(1 ≤ n ≤ 100,000)이 주어진다. 다음 줄에는 인오더를 나타내는 n개의 자연수가 주어지고, 그 다음 줄에는 같은 식으로 포스트오더가 주어진다. www.acmicpc.net 정답 코드는 아래와 같습니다. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 #include class Node ..

백준 11651번 문제(좌표 정렬하기 2) 파이썬(Python) 풀이 [로밍맨]

문제 링크 https://www.acmicpc.net/problem/11651 11651번: 좌표 정렬하기 2 첫째 줄에 점의 개수 N (1 ≤ N ≤ 100,000)이 주어진다. 둘째 줄부터 N개의 줄에는 i번점의 위치 xi와 yi가 주어진다. (-100,000 ≤ xi, yi ≤ 100,000) 좌표는 항상 정수이고, 위치가 같은 두 점은 없다. www.acmicpc.net 정답 코드는 아래와 같습니다. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 import sys class Point: def __init__(self, x, y): self.x = x self.y = y def __lt__(self, other): retur..

백준 11650번 문제(좌표 정렬하기) 파이썬(Python) 풀이 [로밍맨]

문제 링크 https://www.acmicpc.net/problem/11650 11650번: 좌표 정렬하기 첫째 줄에 점의 개수 N (1 ≤ N ≤ 100,000)이 주어진다. 둘째 줄부터 N개의 줄에는 i번점의 위치 xi와 yi가 주어진다. (-100,000 ≤ xi, yi ≤ 100,000) 좌표는 항상 정수이고, 위치가 같은 두 점은 없다. www.acmicpc.net 정답 코드는 아래와 같습니다. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 import sys def solve(): n = int(sys.stdin.readline().rstrip()) arr = [] for _ in range(n): a, b = map(int, sys.stdin.readline().rstrip()...

백준 1654번 문제(랜선 자르기) 파이썬(Python) 풀이 [로밍맨]

문제 링크 https://www.acmicpc.net/problem/1654 1654번: 랜선 자르기 첫째 줄에는 오영식이 이미 가지고 있는 랜선의 개수 K, 그리고 필요한 랜선의 개수 N이 입력된다. K는 1이상 10,000이하의 정수이고, N은 1이상 1,000,000이하의 정수이다. 그리고 항상 K ≦ N 이다. 그 www.acmicpc.net 정답 코드는 아래와 같습니다. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 import sys def calc(start, end, arr, n): if end - start 약 30만, 시간 안에 충분히 계산 가능 풀이는 아래 영상을 참고 바랍니다. https://www.yout..

728x90
반응형