전체 글
-
[HackerRank/Aggregation] Revising Aggregations - Average Population공부/PS ( SQL) 2022. 5. 18. 02:16
https://www.hackerrank.com/challenges/average-population/problem Average Population | HackerRank Query the average population of all cities, rounded down to the nearest integer. www.hackerrank.com 문제 풀이 SELECT ROUND(AVG(POPULATION)) FROM CITY 반올림 (ROUND) 사용법: ROUND(숫자, 반올림할 자릿수) 제거 (TRUNCATE) 사용법: TRUNCATE(숫자, 남길 자릿수(소수n째 자리)) 무조건 버림할 자릿수를 입력해야함 올림 (CEIL) 사용법: CEIL(숫자) 버림 (FLOOR) 사용법: FLOOR(숫자)
-
[HackerRank/Aggregation] Revising Aggregations - Averages공부/PS ( SQL) 2022. 5. 18. 02:10
https://www.hackerrank.com/challenges/revising-aggregations-the-average-function/problem Revising Aggregations - Averages | HackerRank Query the average population of all cities in the District of California. www.hackerrank.com 문제 풀이 SELECT AVG(POPULATION) FROM CITY WHERE DISTRICT LIKE 'California'
-
[BOJ] 1966 프린터 큐 / C++공부/PS (백준) 2022. 5. 18. 02:06
https://www.acmicpc.net/problem/1966 1966번: 프린터 큐 여러분도 알다시피 여러분의 프린터 기기는 여러분이 인쇄하고자 하는 문서를 인쇄 명령을 받은 ‘순서대로’, 즉 먼저 요청된 것을 먼저 인쇄한다. 여러 개의 문서가 쌓인다면 Queue 자료구조에 www.acmicpc.net #include #include using namespace std; int T, N, M; queue q; priority_queue pq; int sequence[110]; int cnt, answer; void init() { for (int i = 0; i = top_priority) { // 현재 문서가 나머지 문서들보다 우선순위가 높음 pq.pop(); sequence[cur_index] ..
-
[programmers] 프린터 / C++공부/PS (programmers) 2022. 5. 18. 00:35
https://programmers.co.kr/learn/courses/30/lessons/42587 코딩테스트 연습 - 프린터 일반적인 프린터는 인쇄 요청이 들어온 순서대로 인쇄합니다. 그렇기 때문에 중요한 문서가 나중에 인쇄될 수 있습니다. 이런 문제를 보완하기 위해 중요도가 높은 문서를 먼저 인쇄하는 프린 programmers.co.kr #include #include #include #include using namespace std; int solution(vector priorities, int location) { int answer = 0, cnt = 1; int sequence[110] = {0, }; // 각 문서가 프린트된 순서를 저장 queue q; priority_queue pq;..
-
[HackerRank/Aggregation] Revising Aggregations - The Count Function공부/PS ( SQL) 2022. 5. 17. 01:19
https://www.hackerrank.com/challenges/revising-aggregations-the-count-function/problem Revising Aggregations - The Count Function | HackerRank Query the number of cities having populations larger than 100000. www.hackerrank.com 문제 풀이 SELECT COUNT(NAME) FROM CITY WHERE POPULATION > 100000
-
[HackerRank/Advanced Select] The PADS공부/PS ( SQL) 2022. 5. 16. 01:29
https://www.hackerrank.com/challenges/the-pads/problem The PADS | HackerRank Query the name and abbreviated occupation for each person in OCCUPATIONS. www.hackerrank.com 문제 풀이 SELECT CONCAT(Name, "(", LEFT(Occupation,1), ")") FROM OCCUPATIONS ORDER BY Name; SELECT CONCAT("There are a total of ", COUNT(occupation), " ", LOWER(Occupation), "s.") FROM OCCUPATIONS GROUP BY Occupation ORDER BY COUNT(..
-
[HackerRank/Advanced Select] Type of Triangle공부/PS ( SQL) 2022. 5. 16. 01:12
https://www.hackerrank.com/challenges/what-type-of-triangle/problem Type of Triangle | HackerRank Query a triangle's type based on its side lengths. www.hackerrank.com 문제 풀이 SELECT CASE WHEN A = B AND B = C THEN 'Equilateral' WHEN A >= B+C OR B >= A+C OR C >= A+B THEN 'Not A Triangle' WHEN A = B OR B = C OR C = A THEN 'Isosceles' ELSE 'Scalene' END FROM TRIANGLES; CASE문 SELECT CASE WHEN 조건 THEN ..
-
[HackerRank/Basic Select] Employee Salaries공부/PS ( SQL) 2022. 5. 16. 00:44
https://www.hackerrank.com/challenges/salary-of-employees/problem Employee Salaries | HackerRank Print the names of employees who earn more than $2000 per month and have worked at the company for less than 10 months. www.hackerrank.com 문제 풀이 SELECT name FROM Employee WHERE salary > 2000 AND months < 10 ORDER BY employee_id