본문 바로가기

USACO

(71)
백준 18322 Word Processor (USACO January 2020 Bronze 1번) 문제 링크: https://www.acmicpc.net/problem/18322 18322번: Word Processor Including "hello" and "my", the first line contains 7 non-space characters. Adding "name" would cause the first line to contain $11>7$ non-space characters, so it is placed on a new line. www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 #include using namespace std; int n, k; string s[101];..
백준 18270 Livestock Lineup (USACO December 2019 Bronze 3번) 문제 링크: https://www.acmicpc.net/problem/18270 18270번: Livestock Lineup Every day, Farmer John milks his 8 dairy cows, named Bessie, Buttercup, Belinda, Beatrice, Bella, Blue, Betsy, and Sue. The cows are rather picky, unfortunately, and require that Farmer John milks them in an order that respects $N$ constraints ($1 \leq N \ www.acmicpc.net 소들을 알파벳 순서데로 정렬하고나서 모든 순열을 next_permutation을 이용하여 돌려보다가..
백준 18269 Where Am I? (USACO December 2019 Bronze 2번) 문제 링크: https://www.acmicpc.net/problem/18269 18269번: Where Am I? The first line of input contains $N$, and the second line contains a string of $N$ characters, each in the range A..Z. www.acmicpc.net 예시 7 ABCDABC 연속된 세개의 letter로는 unique한 위치를 결정할수 없음. (예를들어 "ABC"가 두개의 다른 위치에 존재함). 하지만 연속의 네개의 letter로는 unique한 위치를 결정할수 있기 때문에 답은 4임. 1부터 가능한지 체크해서, 가능한 순간의 갯수를 출력하고 프로그램을 종료시키면 됨. 1 2 3 4 5 6 7 8 9 ..
백준 18268 Cow Gymnastics (USACO December 2019 Bronze 1번) 문제 링크: https://www.acmicpc.net/problem/18268 18268번: Cow Gymnastics The consistent pairs of cows are $(1,4)$, $(2,4)$, $(3,4)$, and $(1,3)$. www.acmicpc.net 각각의 pair에 대해서 K sessions 동안 한마리가 다른 한마리보다 계속 등수가 앞서면 답을 1 증가시킴. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 #include using namespace std; int N, K, ranking[11][21]; int main() { ios_base::sync_with_stdio(..
백준 17199 Milk Factory (USACO US Open 2019 Bronze 2번) 문제 링크: https://www.acmicpc.net/problem/17199 17199번: Milk Factory The milk business is booming! Farmer John's milk processing factory consists of $N$ processing stations, conveniently numbered $1 \ldots N$ ($1 \leq N \leq 100$), and $N-1$ walkways, each connecting some pair of stations. (Walkways are expensive, so Farmer www.acmicpc.net a, b를 거꾸로 받아서, i = 1 ~ N번 순서대로 station i에서 다른 모든 station으로 ..
백준 17198 Bucket Brigade (USACO US Open 2019 Bronze 1번) 문제 링크: https://www.acmicpc.net/problem/17198 17198번: Bucket Brigade The input file contains 10 rows each with 10 characters, describing the layout of the farm. There are exactly one barn, one lake, and one rock. www.acmicpc.net 불과 연못이 일직선상에 있으면서 그 사이에 바위가 있는 경우에 살짝 돌아가야 하는 부분만 처리해주면 됨. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 #include using namespace st..
백준 17041 Measuring Traffic (USACO February 2019 Bronze 3번) 문제 링크: https://www.acmicpc.net/problem/17041 17041번: Measuring Traffic In this example, the combination of readings from segments 2 and 3 tell us that the flow rate through these segments is somewhere in the range $[11, 14]$, since only this range is consistent with both the readings $[10,14]$ and $[11,15]$. In mile 1, exactl www.acmicpc.net 1. N마일 지나고 나서 range를 구하는것과 2. 1마일 이전에 range를 구하는것 두가지 ..
백준 17040 The Great Revegetation (USACO February 2019 Bronze 2번) 문제 링크: https://www.acmicpc.net/problem/17040 17040번: The Great Revegetation (Bronze) Output an $N$-digit number, with each digit in the range $1 \ldots 4$, describing the grass type to be planted in each field. The first digit corresponds to the grass type for field $1$, the second digit to field $2$, and so on. If there are multiple valid www.acmicpc.net 어떤 한 소가 좋아하는 두개의 pasture에 같은 grass를 심을수 ..