구현

Algorithm/PS

[BOJ/백준] 6845 - Federal Voting Age [python]

문제 링크 6845번: Federal Voting Age The input will consist of a number n (1 ≤ n ≤ 100) on a single line, indicating the number of birthdays to evaluate. Then, each of the following n lines, will be of the form y m d, where y is the year of a potential voter’s birth (0 ≤ y ≤ 2007), www.acmicpc.net 문제 풀이 2007년 2월 27일 선거에 선거할 수 있는 나이일 경우 Yes를 출력하고, 아닐 경우 No를 출력해준다. 예제 입력 예시를 보면, 1989년 2월 28일 생은 No이지만, ..

Algorithm/PS

[BOJ/백준] 6830 - It’s Cold Here! [python]

문제 링크 6830번: It’s Cold Here! Canada is cold in winter, but some parts are colder than others. Your task is very simple, you need to find the coldest city in Canada. So, when given a list of cities and their temperatures, you are to determine which city in the list has the lowest tempe www.acmicpc.net 문제 풀이 이 문제는 주어지는 입력값 중 가장 낮은 온도의 도시를 출력하는 문제이다. 입력값이 얼마나 들어올 지 모르므로 try - except 문을 사용해 EOF가 입력될..

Algorithm/PS

[BOJ/백준] 6812 - Good times [python]

문제 링크 6812번: Good times A mobile cell service provider in Ottawa broadcasts an automated time standard to its mobile users that reflects the local time at the user’s actual location in Canada. This ensures that text messages have a valid local time attached to them. For example www.acmicpc.net 문제 풀이 이 문제는 주어진 입력값으로 각각의 지역 시간대로 변환해 출력해야하는 문제이다. 이 문제에서 주의할 점은 다음과 같다. 입력값은 0부터 2359사이의 수이다. (ex. 0을 ..

Algorithm/PS

[BOJ/백준] 6784 - Multiple Choice [python]

문제 링크 6784번: Multiple Choice The input will contain the number N (0 < N < 10000) followed by 2N lines. The 2N lines are composed of N lines of student responses (with one of A,B,C,D or E on each line), followed by N lines of correct answers (with one of A,B,C,D or E on each line), in www.acmicpc.net 문제 풀이 처음 주어진 수만큼 리스트를 두 번 구성하는데, 두 리스트를 처음부터 순서대로 비교했을 때, 값이 같은 경우의 수를 구해준다. 최대 20000개의 문자가 들어올 수..

Algorithm/PS

[BOJ/백준] 6780 - Sumac Sequences [python]

문제 링크 6780번: Sumac Sequences In a sumac sequence, t1, t2, .., tm, each term is an integer greater than or equal 0. Also, each term, starting with the third, is the difference of the preceding two terms (that is, tn+2 = tn − tn+1 for n ≥ 1). The sequence terminates at tm if tm−1 www.acmicpc.net 문제 풀이 입력값으로 주어진 값이 t1, t2일 때, t3은 t2 - t1이고, t3 < t2의 관계여야 한다. 이 규칙을 지키는 수열의 길이를 구하면 된다. 정답 코드 cnt = 2 ..

Algorithm/PS

[BOJ/백준] 6779 - Who Has Seen The Wind [python]

문제 링크 6779번: Who Has Seen The Wind The input is two non-negative integers: h, the humidity factor, followed by M, the maximum number of hours Margaret will wait for the weather balloon to return to ground. You can assume 0 ≤ h ≤ 100 and 0 < M < 240. www.acmicpc.net 문제 풀이 문제에 주어진 방정식을 가지고 계산된 A가 0 이하가 되는 경우의 최소 t값을 구하는 문제이다. 만약 M보다 t가 커진다면 "The balloon does not touch ground in the given time."이라는..

Algorithm/PS

[BOJ/백준] 6750 - Rotating letters [python]

문제 링크 6750번: Rotating letters An artist wants to construct a sign whose letters will rotate freely in the breeze. In order to do this, she must only use letters that are not changed by rotation of 180 degrees: I, O, S, H, Z, X, and N. Write a program that reads a word and determines wh www.acmicpc.net 문제 풀이 입력되는 문자열 중 I, O, S, H, Z, X, N이 아닌 문자가 포함되어있는 경우, NO를 출력하고 아니라면 YES를 출력한다. 정답 코드 for i in..

Algorithm/PS

[BOJ/백준] 6721 - Backward numbers [python]

문제 링크 6721번: Backward numbers Backward numbers are numbers written in ordinary Arabic numerals but the order of the digits is reversed. The first digit becomes the last, and vice versa. For example, the number 1245 becomes 5421. Note that all leading zeroes are omitted. This means that www.acmicpc.net 문제 풀이 주어진 두 입력값을 거꾸로 뒤집어서 합을 구해준 뒤, 그 합을 다시 뒤집어서 출력해주면 된다. 정답 코드 for _ in range(int(input())) :..

chanwoong1
'구현' 태그의 글 목록 (6 Page)