본문 바로가기

ALL

(300)
[해커랭크(HackerRank)] Placements (MySQL) 문제 You are given three tables: Students, Friends and Packages. Students contains two columns: ID and Name. Friends contains two columns: ID and Friend_ID (ID of the ONLY best friend). Packages contains two columns: ID and Salary (offered salary in $ thousands per month). Write a query to output the names of those students whose best friends got offered a higher salary than them. Names must be or..
[해커랭크(HackerRank)] Weather Observation Station 3 (MySQL) 문제 Query a list of CITY names from STATION for cities that have an even ID number. Print the results in any order, but exclude duplicates from the answer. The STATION table is described as follows: where LAT_N is the northern latitude and LONG_W is the western longitude. 코드 select distinct city from station where id % 2 = 0 -- even Id Number 짝수 아이디만 출력 출력
[해커랭크(HackerRank)] Weather Observation Station 20 (MySQL) 문제 A median is defined as a number separating the higher half of a data set from the lower half. Query the median of the Northern Latitudes (LAT_N) from STATION and round your answer to 4 decimal places. Input Format The STATION table is described as follows: where LAT_N is the northern latitude and LONG_W is the western longitude. 코드 select round(avg(lat_n),4) from (select lat_n, row_number() o..
[백준알고리즘] 2753번 윤년 (Python) 문제 연도가 주어졌을 때, 윤년이면 1, 아니면 0을 출력하는 프로그램을 작성하시오. 윤년은 연도가 4의 배수이면서, 100의 배수가 아닐 때 또는 400의 배수일 때이다. 예를 들어, 2012년은 4의 배수이면서 100의 배수가 아니라서 윤년이다. 1900년은 100의 배수이고 400의 배수는 아니기 때문에 윤년이 아니다. 하지만, 2000년은 400의 배수이기 때문에 윤년이다. 입력 첫째 줄에 연도가 주어진다. 연도는 1보다 크거나 같고, 4000보다 작거나 같은 자연수이다. 출력 첫째 줄에 윤년이면 1, 아니면 0을 출력한다. 코드 year = int(input()) if year % 4 == 0 and (year % 100 != 0 or year % 400 == 0) : print(1) else ..