Derek USACO

  Рет қаралды 11

Pro Coding

Pro Coding

Күн бұрын

USACO 2020 December Contest, Bronze
Problem 1. Do You Know Your ABCs?
A
B
C
A + B
B + C
A + C
A + B + C
Observation 1 : A == B and B == C and C ==A, they are all the same
Observation 2 : A + B + C must be the largest
Therefore, it is ideal to store all the seven number in an array
array = [A + B + C, A, B, C, A + B, A + C, B + C]
obviously, the question does not say the data is sorted…therefore it is very suspicious that we want to sort array first
that leads to using sort(array, array + N)
and then, the largest number is array[N - 1] → easily get A + B + C → sum of three numbers
it is guarantee that the smallest data in array is array[0] → A
Now, the question is solving two unknowns with one is solved and sum of the three is solved.
A +B + C = T
A = K
B + C = ?
yes, B is the one next to A therefore B = array[1]
now, we know A, B, A + B + C , and then C is (A + B + C) - A - B = A + B + C - A - B = C
C = A + B + C - array[0] - array[1]

Пікірлер
Kubernetes 101 workshop - complete hands-on
3:56:03
Kubesimplify
Рет қаралды 1,6 МЛН
Compiler Q&A, September 2024
2:10:03
Jonathan Blow
Рет қаралды 24 М.
Крутой фокус + секрет! #shorts
00:10
Роман Magic
Рет қаралды 27 МЛН
Robert Greene: A Process for Finding & Achieving Your Unique Purpose
3:11:18
Andrew Huberman
Рет қаралды 12 МЛН
FOP OBJECTS AND CLASSES
2:10:56
Rogelio de la Garza
Рет қаралды 6
Building the Ultimate Workout Tracker with React Native & MongoDB
3:59:34
Every Sorting Algorithm Explained in 120 minutes (full series)
1:57:33
Kuvina Saydaki
Рет қаралды 66 М.
Math for Game Devs [2022, part 1] • Numbers, Vectors & Dot Product
3:57:35
Animation vs. Math
14:03
Alan Becker
Рет қаралды 70 МЛН
Flutter Engage
3:58:21
Flutter
Рет қаралды 1,9 МЛН
Enter The Arena: Simplifying Memory Management (2023)
1:47:50
Ryan Fleury
Рет қаралды 42 М.
Errichto Stream, POI 22/1
3:55:08
Errichto Algorithms
Рет қаралды 157 М.