목록분류 전체보기 (494)
규도자 개발 블로그
HackerLand University has the following grading policy:Every student receives a in the inclusive range from to .Any less than is a failing grade.Sam is a professor at the university and likes to round each student's according to these rules:If the difference between the and the next multiple of is less than , round up to the next multiple of .If the value of is less than , no rounding occurs as ..
Sam's house has an apple tree and an orange tree that yield an abundance of fruit. In the diagram below, the red region denotes his house, where is the start point, and is the endpoint. The apple tree is to the left of his house, and the orange tree is to its right. You can assume the trees are located on a single point, where the apple tree is at point , and the orange tree is at point .When a ..
[백준/10950/파이썬] A+B - 3 문제 두 정수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오. 입력 첫째 줄에 테스트 케이스의 개수 T가 주어진다.각 테스트 케이스는 한 줄로 이루어져 있으며, 각 줄에 A와 B가 주어진다. (0 < A, B < 10) 출력 각 테스트 케이스마다 A+B를 출력한다. 입출력 예 입력출력 5 1 1 2 3 3 4 9 8 5 22 5 7 17 7 풀이 count = int(input()) result_list = [] for i in range(count): number_input = input().split() number_input = map(int, number_input) result_list.append(sum(number_input)) f..
WHERE 1 = 1 TRICK 세상에 절대적인 것은 없다. 데이터베이스에서 특정 데이터를 불러와야 할 때 전용으로 만들어져있는 객체나 라이브러리를 이용하면 좋지만 불가피하게 다이나믹쿼리를 통해 구현해야 할 때가 있기 마련이다. 다이나믹쿼리로 구성돼있는 어플리케이션을 유지보수하거나, 혹은 특수한 쿼리를 이용해야할 때 등 말이다. 그럴 때 유용하게 쓸 수 있는 게 바로 WHERE 1 = 1 트릭이다. 간단한 sql은 이곳(sqltest.net)에서 실험할 수 있다. sqltest에 들어가서 오른쪽에 Select Database를 눌러 MYSQL로 설정한 뒤에 SQL Script란에 아래 sql을 입력하자. CREATE TABLE mysql_test ( id INT(6) UNSIGNED AUTO_INCREM..
[JavaScript/자바스크립트] 숫자 천 단위마다 콤마 찍는 내장 함수(toLocaleString) 나는 예전에 이런 글을 쓴 적이 있다. [JavaScript/자바스크립트] 숫자 천 단위마다 콤마 찍는 함수 정규식을 통해서 3자리마다 콤마를 찍고 반환하는 아주 간단한 함수인데 얼마 전에 다른 입출력값이 필요했다. 그러니까 위 게시물에 있는 함수인 function numberFormat(inputNumber) { return inputNumber.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); } 은 소수자리까지도 콤마처리해버려서 쓰기 곤란했다. 그래서 더 찾아보니 자바스크립트 안에는 위 함수를 대체할만 한 아주 훌륭한 함수가 있었다. 바로 제목에도 써있는 t..
You are in charge of the cake for your niece's birthday and have decided the cake will have one candle for each year of her total age. When she blows out the candles, she’ll only be able to blow out the tallest ones. Your task is to find out how many candles she can successfully blow out.For example, if your niece is turning years old, and the cake will have candles of height , , , , she will be..
Given five positive integers, find the minimum and maximum values that can be calculated by summing exactly four of the five integers. Then print the respective minimum and maximum values as a single line of two space-separated long integers.For example, . Our minimum sum is and our maximum sum is . We would print16 24 Function DescriptionComplete the miniMaxSum function in the editor below. It ..
Consider a staircase of size : # ## ### #### Observe that its base and height are both equal to , and the image is drawn using # symbols and spaces. The last line is not preceded by any spaces.Write a program that prints a staircase of size .Function DescriptionComplete the staircase function in the editor below. It should print a staircase as described above.staircase has the following paramete..
Given an array of integers, calculate the fractions of its elements that are positive, negative, and are zeros. Print the decimal value of each fraction on a new line.Note: This challenge introduces precision problems. The test cases are scaled to six decimal places, though answers with absolute error of up to are acceptable.For example, given the array there are elements, two positive, two nega..
Given a square matrix, calculate the absolute difference between the sums of its diagonals.For example, the square matrix is shown below:1 2 3 4 5 6 9 8 9 The left-to-right diagonal = . The right to left diagonal = . Their absolute difference is .Function descriptionComplete the function in the editor below. It must return an integer representing the absolute diagonal difference.diagonalDifferen..