본문 바로가기

USACO

(71)
백준 5948 Bad Random Numbers (USACO December 2010 Bronze 2번) 문제 링크: https://www.acmicpc.net/problem/5948 5948번: Bad Random Numbers Bessie is trying to generate random numbers. She stumbled upon an old reference to the 'middle square' method for making numbers that appear to be random. It works like this: Pick a starting four digit number (1 n; while(!v[n]) { v[n] = 1; n = n / 100 % 10 * 10 + n / 10 % 10; n *= n; ans++; } cout
백준 5947 Book Club (USACO December 2010 Bronze 1번) 문제 링크: https://www.acmicpc.net/problem/5947 5947번: Book Club Bessie is looking for cows to join her book club. While the herd has N (2 n >> q >> p; for(int i = 1; i a[i][j]; for(int i = 0; i > qj >> aj; for(int j = 1; j
백준 14453 Hoof, Paper, Scissors (USACO January 2017 Silver 2번) 문제 링크: https://www.acmicpc.net/problem/14453 14453번: Hoof, Paper, Scissors (Silver) You have probably heard of the game "Rock, Paper, Scissors". The cows like to play a similar game they call "Hoof, Paper, Scissors". The rules of "Hoof, Paper, Scissors" are simple. Two cows play against each-other. They both count to three and then each s www.acmicpc.net Prefix Sum 1 2 3 4 5 6 7 8 9 10 11 12 13 ..
백준 14452 Cow Dance Show (USACO January 2017 Silver 1번) 문제 링크: https://www.acmicpc.net/problem/14452 14452번: Cow Dance Show After several months of rehearsal, the cows are just about ready to put on their annual dance performance; this year they are performing the famous bovine ballet "Cowpelia". The only aspect of the show that remains to be determined is the size of the stage www.acmicpc.net Binary Search 예시 5 8 4 7 8 6 4 state에 한꺼번에 올라갈수 있는 소들의 수 ..
백준 14172 Moocast (USACO December 2016 Silver 3번) 문제 링크: https://www.acmicpc.net/problem/14172 14172번: Moocast Write a single line of output containing the maximum number of cows a broadcast from a single cow can reach. The originating cow is included in this number. www.acmicpc.net DFS 각 cow마다 얼마나 많은 다른 소한테 연결될수 있는지를 구하고, 그 중 최대값을 구하면 됨. 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 33 34 35 36 37 38 39..
백준 14171 Cities and States (USACO December 2016 Silver 2번) 문제 링크: https://www.acmicpc.net/problem/14171 14171번: Cities and States To keep his cows intellectually stimulated, Farmer John has placed a large map of the USA on the wall of his barn. Since the cows spend many hours in the barn staring at this map, they start to notice several curious patterns. For example, the cities of Fl www.acmicpc.net city, state의 앞 두 letter들을 네자리수로 만들어서 state들을 기준으로 vect..
백준 14170 Counting Haybales (USACO December 2016 Silver 1번) 문제 링크: https://www.acmicpc.net/problem/14170 14170번: Counting Haybales Farmer John has just arranged his N haybales (1≤N≤100,000) at various points along the one-dimensional road running across his farm. To make sure they are spaced out appropriately, please help him answer Q queries (1≤Q≤100,000), each asking for the number www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 #..
백준 12003 Diamond Collector (USACO US Open 2016 Silver 2번) 문제 링크: https://www.acmicpc.net/problem/12003 12003번: Diamond Collector (Silver) The first line of the input file contains \(N\) and \(K\) (\(0 \leq K \leq 1,000,000,000\)). The next \(N\) lines each contain an integer giving the size of one of the diamonds. All sizes will be positive and will not exceed \(1,000,000,000\). www.acmicpc.net 예시 7 3 10 5 1 12 9 5 14 1. 먼저 sort 함. => a = [1 5 5 9 10 1..