PS223 [백준 05365] Decoder [Python] 문제 All the Sith messages are sent using a complex coding scheme. You have cracked their code and must write a program to decode coded messages. Their code works as follows. Each word in the coded message represents one letter in the decoded message. Use the first letter of the first word and for each subsequent word use the nth letter where n is the length of the previous word. If the previous w.. 2024. 6. 24. [백준 05343] Parity Bit [Python] 문제A parity bit, or check bit, is a bit that is added to the end of a sequence of bits for error detection. In telecommunications and computing all data is transformed into a sequence of zeros and ones. For this problem you may assume that all information is coded using 8 bits, with the first 7 bits used for data and the last bit used as the parity bit. The parity bit is set to one if the number .. 2024. 6. 23. [2024 KAKAO WINTER INTERNSHIP] 도넛과 막대 그래프 [Python] 풀이도넛, 막대, 8자 그래프의 수와 이를 연결하는 중앙 정점의 번호를 구하는 문제다.문제에서 그래프 수의 합은 2 이상이라고 주어졌다.때문에 2개 이상의 단방향 연결을 가지는 정점이 중앙 정점이 될 수 있다.edges에 대해 다른 정점으로 단방향 연결을 하는지( out ) 연결 되는지( in ) dict을 활용해 기록해 주자.그래프를 완전 탐색하지 않고, 문제를 해결하는게 중요하다.각 그래프별 특징을 구해서 선형 탐색으로 풀이해보자. 우선 도넛 모양 그래프의 경우 단순히 단방향 연결 여부로만 판단하기에는 그렇다할 특징이 없다.막대 그래프의 경우 out이 존재하지 않는 정점이 1개 있다. 8자 그래프의 경우 out이 2개고, in이 2개인(0이 아닌) 정점이 존재한다.만약 in이 0이라면 그 정점은 중앙.. 2024. 6. 22. [2024 KAKAO WINTER INTERNSHIP] 가장 많이 받은 선물 [Python] 풀이이번 달 까지의 선물을 주고받은 기록과 선물 지수를 토대로 다음달에 선물을 많이 받는 사람을 예측하는 문제다.문제에서 주어진 조건은 다음과 같다.1. 선물 기록이 있다면 더 많은 선물을 준 사람이 선물을 받는다.2. 선물 기록이 없거나 같다면, 선물 지수가 더 큰사람이 받는다.선물 지수는 이번 까지 자신이 친구들에게 준 선물 수에서 받은 선물 수를 뺀 값이다.즉, 받은것보다 준 횟수가 더 많다면 선물 지수는 높아진다.먼저 3개의 dict을 만들어 주자.각각 선물을 주고받은 기록( gift_history ), 선물 지수( gift_level ), 다음 달에 받을 선물 수( give )이다.gift_history의 경우 여러명으로부터 여러개의 선물을 받기 때문에 중첩 구조로 구성하자.참고로 문제에서 자기.. 2024. 6. 21. [HackerRank] Revising the Select Query II [MySQL] 풀이CITY 테이블에서 POPULATION이 120000보다 크고,COUNTRYCODE가 "USA"인 컬럼의 NAME 속성을 출력하는 문제다.소스코드보기출처 Revising the Select Query II | HackerRankQuery the city names for all American cities with populations larger than 120,000.www.hackerrank.com 2024. 6. 21. [HackerRank] Revising the Select Query I [MySQL] 풀이CITY 테이블에서 COUNTRYCODE가 "USA" 이고,POPULATION이 100000보다 큰 컬럼의 모든 속성을 출력하는 문제다.소스보기보기출처 Revising the Select Query I | HackerRankQuery the data for all American cities with populations larger than 100,000.www.hackerrank.com 2024. 6. 21. 이전 1 ··· 21 22 23 24 25 26 27 ··· 38 다음