본문 바로가기

Algorithm

(131)
[백준알고리즘] 5355번 화성 수학 (Python) 문제 겨울 방학에 달에 다녀온 상근이는 여름 방학 때는 화성에 갔다 올 예정이다. (3996번) 화성에서는 지구와는 조금 다른 연산자 @, %, #을 사용한다. @는 3을 곱하고, %는 5를 더하며, #는 7을 빼는 연산자이다. 따라서, 화성에서는 수학 식의 가장 앞에 수가 하나 있고, 그 다음에는 연산자가 있다. 입력 첫째 줄에 테스트 케이스의 개수 T가 주어진다. 다음 줄에는 화성 수학식이 한 줄에 하나씩 주어진다. 입력으로 주어지는 수는 정수이거나 소수 첫째 자리까지 주어지며, 0 이상 100 이하이다. 연산자는 최대 3개 주어진다. 출력 각 테스트 케이스에 대해서, 화성 수학식의 결과를 계산한 다음에, 소수점 둘째 자리까지 출력한다. 코드 T = int(input()) for i in range(..
[해커랭크(HackerRank)] Average Population (MySQL) 문제 Query the average population for all cities in CITY, rounded down to the nearest integer. Input Format The CITY table is described as follows: 코드 Select ROUND(AVG(population)) From City City 테이블에서 모든 도시의 평균 반올림 (정수와 가장 가까운 수) 출처
[해커랭크(HackerRank)] Revising Aggregations - Averages (MySQL) 문제 Query the average population of all cities in CITY where District is California. Input Format The CITY table is described as follows: 코드 Select AVG(population) From City Where district = 'California' City 테이블에서 California의 인구 평균 구하기 출처
[해커랭크(HackerRank)] Weather Observation Station 11 (MySQL) 문제 Query the list of CITY names from STATION that either do not start with vowels or do not end with vowels. Your result cannot contain duplicates. Input Format The STATION table is described as follows: 코드 SELECT distinct city FROM Station WHERE substring(city, -1) NOT IN ('a','e','i','o','u') OR substring(city, 1, 1) NOT IN ('a','e','i','o','u') Station테이블에서 city이름의 첫글자나 끝글자가 모음이 아닌 컬럼 출력 중복 금..