1 / 10

Where is Johnny Ho?

Where is Johnny Ho?. Answer: Italy. Three levels: bronze, silver, gold Starts off in bronze division Do well and be promoted to silver and gold 16 finalists in gold go to USACO training camp 4 chosen for US team to go to IOI 6 contests throughout the year Nov, Dec, Jan, Feb, Mar, Apr.

osborn
Download Presentation

Where is Johnny Ho?

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Where is Johnny Ho? Answer: Italy

  2. Three levels: bronze, silver, gold • Starts off in bronze division • Do well and be promoted to silver and gold • 16 finalists in gold go to USACO training camp • 4 chosen for US team to go to IOI • 6 contests throughout the year • Nov, Dec, Jan, Feb, Mar, Apr

  3. Held 3-4 times a year • At Gunn, Harker, (possibly Monta Vista), and Stanford • Teams of 3 people solve 12 problems in 2 hours • 4 each of 2 point, 5 point, and 9 point problems • Top 3 teams win prizes! • Free food!

  4. Contests: More Contests • Quixey Challenge • Short program written in python with 1 line bug. • 1 bug, 1 minute, $100. • Online contests held every 1-2 weeks. • Varying difficulty. • Extensive problem set. • Many online contests. • Win cash prizes! • Software companies recruit people here.

  5. Euclidean Algorithm (GCD) • Find greatest common divisor of two numbers • From Euclid’s book Elements • Oldest nontrivial algorithm • O(log n) runtime complexity • This means it’s FAST!!!!! • Key observation: GCD (x, x+y) = GCD (x, y) • Example: find GCD (162, 234) • Use the Euclidean Algorithm! • GCD (162, 234) = GCD (162, 72) • GCD (72, 162) = GCD (72, 90) = GCD (72, 18) • 72 = 4 x 18

  6. Euclidean Algorithm Code • Implementation (very short!) public intgcd (int a, int b) { if (b == 0) { return a; } else { return gcd(b, a % b); } }

  7. Problem of the Week • Problems related to that week’s lecture • Yes, this week’s PotW will be on GCD! • Concepts and tricks for USACO and other contests • Will be posted on our website at lynbrookcs.com • Varying difficulties and points • Graded based on guidelines specified in problem • Officers reserve the right to grade as they please :] • Code should run in one second • About 100-500 million operations • Email solutions to potw@lynbrookcs.com by Sunday 11:59 PM • Any programming language accepted • Console input/output (System.in, System.out) unless otherwise specified • Submit as many times as you want • Solution will be presented at next meeting • See your score at lynbrookcs.com/potw • Feedback is always welcome • Earn Prizes!

  8. First PotW of the Year! • Farmer Johnny Ho has N gold medals and M t-shirts • He wants to divide them into identical groups • All groups must have the same number of t-shirts • All groups must have the same number of medals. • He has too many of both so he is having a hard time trying to figure out how many different ways he can divide them. Help him out! • Example: N = 6, M = 4. • Farmer Johnny Ho can do this in two ways. • 1 group of 6 medals and 4 t-shirts • 2 groups of 3 medals and 2 t-shirts • Constraints: • Easy (10 points): N < 100, M < 100 • Medium (20 points): N < 10000, M < 10000 • Hard (25 points): N ^ 109, M < 109

  9. Hints! • How to read input and print output JAVA: import java.util.*; ... Scanner in; in = new Scanner(System.in); int N = in.nextInt(); int M = in.nextInt(); System.out.println(N+M); C++: #include <iostream> using namespace std; ... int N, M; cin >> N >> M; cout << N+M << endl;

More Related