내가 까먹을까봐 만든 블로그

전체 글

Computer Science/Algorithm

[C++] 백준 1065 - 한수

문제https://www.acmicpc.net/problem/1065 1065번: 한수어떤 양의 정수 X의 각 자리가 등차수열을 이룬다면, 그 수를 한수라고 한다. 등차수열은 연속된 두 개의 수의 차이가 일정한 수열을 말한다. N이 주어졌을 때, 1보다 크거나 같고, N보다 작거나www.acmicpc.net 해설1~99까지는 무조건 등차수열이 될 것이다. 비교할 3번째 항이 없기 때문이다. 100 이상은 각 자릿수를 분해하여 계산해 보면 된다. #include using namespace std;int hansu(int x) { int res = 0, th, h, t, n; for (int i = 1; i = 1000) { th = 1; h = int((i - th * 1000) / 100); ..

Computer Science/Algorithm

[Python] 백준 11721 - 열 개씩 끊어 출력하기

문제https://www.acmicpc.net/problem/11721 11721번: 열 개씩 끊어 출력하기첫째 줄에 단어가 주어진다. 단어는 알파벳 소문자와 대문자로만 이루어져 있으며, 길이는 100을 넘지 않는다. 길이가 0인 단어는 주어지지 않는다.www.acmicpc.net 해설 txt = input()for i in range((len(txt) / 10).__ceil__()): print(txt[i * 10 : (i + 1) * 10])

Computer Science/Algorithm

[Python] 백준 28288 - Special Event

문제https://www.acmicpc.net/problem/28288 28288번: Special EventThe first line of input will contain a positive integer $N$, representing the number of people interested in attending your event. The next $N$ lines will each contain one person's availability using one character for each of Day $1$, Day $2$, Day $3$, Daywww.acmicpc.net 해설numpy를 사용 못하니 map을 이용해서 계산해보았다. person = int(input())schedule =..

Computer Science/Algorithm

[C++] 백준 11399 - ATM

문제https://www.acmicpc.net/problem/11399 11399번: ATM첫째 줄에 사람의 수 N(1 ≤ N ≤ 1,000)이 주어진다. 둘째 줄에는 각 사람이 돈을 인출하는데 걸리는 시간 Pi가 주어진다. (1 ≤ Pi ≤ 1,000)www.acmicpc.net 해설입력된 시간을 정렬하여 누적합을 구하면 되는 문제이다. #include#includeusing namespace std;void atm(){ int n; int temp = 0; int res = 0; cin >> n; int* times = new int[n]; for (int i = 0; i > times[i]; } sort(times, times + n); for (int i = 0; i

Computer Science/Algorithm

[Python] 백준 6973 - Dynamic Dictionary Coding

문제https://www.acmicpc.net/problem/6973 6973번: Dynamic Dictionary CodingA common method of data compression, "dictionary coding", is to replace words in a text by numbers indicating their positions in a dictionary. Static dictionary coding, in which the dictionary is known in advance, can be problematic, as it is necessary towww.acmicpc.net 해설처음 입력된 case만큼의 단어 사전을 만드는 문제이다. 각 case는 여러 문장을 입력받고 모든..

Computer Science/Computer Network

[네트워크 실습] 네트워크 구성 - BGP(Border Gateway Protocol)

1. 주요 개념 BGP(Border Gateway Protocol) AS(Autonomous) BGP(Border Gateway Protocol)는 OSPF의 Area라는 개념과 비슷한 AS(Autonomous)라는 개념을 사용해서 통신한다. 서로 다른 AS 간의 BGP Session을 External BGP, 동일 AS내의 BGP Router 간의 BGP Session을 Internal BGP라고 한다. 아래는 미리 구상된 토폴로지의 구조이다. 위 토폴로지를 토대로 네트워크를 구축한다. 2. 구축 BGP의 명령은 아래와 같다. set protocols bgp [as number] neighbor [neighbor network address] remote-as '[neighbor as number]' ..

alien_coder
외부 저장소