본문 바로가기

USACO/Bronze

(56)
백준 5939 Race Results (USACO November 2010 Bronze 2번) 문제 링크: https://www.acmicpc.net/problem/5939 5939번: Race Results The herd has run its first marathon! The N (1
백준 5938 Daisy Chains in the Field (USACO November 2010 Bronze 1번) 문제 링크: https://www.acmicpc.net/problem/5938 5938번: Daisy Chains in the Field Farmer John let his N (1 > u >> v; adj[u].push_back(v); adj[v].push_back(u); } dfs(1); if(cnt == n) cout
백준 18788 Swapity Swap (USACO February 2020 Bronze 3번) 문제 링크: https://www.acmicpc.net/problem/18788 18788번: Swapity Swap Initially, the order of the cows is $[1,2,3,4,5,6,7]$ from left to right. After the first step of the process, the order is $[1,5,4,3,2,6,7].$ After the second step of the process, the order is $[1,5,7,6,2,3,4]$. Repeating both steps a second time yields t www.acmicpc.net 배열의 처음 상태로 몇번만에 돌아오는지 period를 먼저 계산하고, 실제로 k번을 반복하는 대신 k % ..
백준 18787 Mad Scientist (USACO February 2020 Bronze 2번) 문제 링크: https://www.acmicpc.net/problem/18787 18787번: Mad Scientist First, FJ can transform the substring that corresponds to the first character alone, transforming $B$ into GHGGGHH. Next, he can transform the substring consisting of the third and fourth characters, giving $A$. Of course, there are other combinations of t www.acmicpc.net 예시 7 GHHHGHH HHGGGHH 앞에서부터 훑으면서 첫번째 자리가 다르므로 한번 toggle해주고,..
백준 18786 Triangles (USACO February 2020 Bronze 1번) 문제 링크: https://www.acmicpc.net/problem/18786 18786번: Triangles (Bronze) Posts at $(0,0)$, $(1,0)$, and $(1,2)$ form a triangle of area $1$. Thus, the answer is $2\cdot 1=2$. There is only one other triangle, with area $0.5$. 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 32 #include using namespace std; struct coord { int x, y; }; int n; coord..
백준 18323 Photoshoot (USACO January 2020 Bronze 2번) 문제 링크: https://www.acmicpc.net/problem/18323 18323번: Photoshoot Farmer John is lining up his $N$ cows ($2\le N\le 10^3$), numbered $1\ldots N$, for a photoshoot. FJ initially planned for the $i$-th cow from the left to be the cow numbered $a_i,$ and wrote down the permutation $a_1,a_2,\ldots,a_N$ on a sheet of paper. U www.acmicpc.net 예시 1 5 4 6 7 6 첫수를 1부터 4 - 1 까지 시도해 보면서 가능할때 출력하면 됨. 첫수가 1일때:..
백준 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을 이용하여 돌려보다가..