Die Präsentation wird geladen. Bitte warten

Die Präsentation wird geladen. Bitte warten

Aufgabenbesprechung Programming Contest. Order 7 Bo Pat Jean Kevin Claude William Marybeth 6 Jim Ben Zoe Joey Frederick Annabelle 0 SET 1 Bo Jean Claude.

Ähnliche Präsentationen


Präsentation zum Thema: "Aufgabenbesprechung Programming Contest. Order 7 Bo Pat Jean Kevin Claude William Marybeth 6 Jim Ben Zoe Joey Frederick Annabelle 0 SET 1 Bo Jean Claude."—  Präsentation transkript:

1 Aufgabenbesprechung Programming Contest

2 Order 7 Bo Pat Jean Kevin Claude William Marybeth 6 Jim Ben Zoe Joey Frederick Annabelle 0 SET 1 Bo Jean Claude Marybeth William Kevin Pat SET 2 Jim Zoe Frederick Annabelle Joey Ben

3 Order Input: The input consists of one or more sets of strings, followed by a final line containing only the value 0. Each set starts with a line containing an integer, n, which is the number of strings in the set, followed by n strings, one per line, sorted in nondescending order by length. None of the strings contain spaces. There is at least one and no more than 15 strings per set. Each string is at most 25 characters long. Output: For each input set print "SET n" on a line, where n starts at 1, followed by the output set as shown in the sample output.

4

5 Speed 2 * 20 + (6-2) * 30 + (7-6) * 10 = * 60 + (5-1) * 30 = * 15 + (2-1) * 25 + (3-2) * 30 + (5-3) * 10 = 90

6 Speed Input: The input consists of one or more data sets. Each set starts with a line containing an integer n, 1 n 10, followed by n pairs of values, one pair per line. The first value in a pair, s, is the speed in miles per hour and the second value, t, is the total elapsed time. Both s and t are integers, 1 s 90 and 1 t 12. The values for t are always in strictly increasing order. A value of -1 for n signals the end of the input. Output: For each input set, print the distance driven, followed by a space, followed by the word "miles".

7

8 Longnight The input contains several test cases. The first line of a test case contains one integer N, which indicates the number of museums participating in the event (1 <= N <= 20). The second line of a test case contains N integers indicating the time, in minutes, needed to visit each museum. Then there are N lines describing the times to go from one museum to every other. You may assume that the i-th integer in the i-th line is equal to zero. The end of input is indicated by N = 0 For each test case in the input, your program must produce one line containing the maximum number of museums that can be visited during the Long Night of Museums.

9 Longnight

10 Einlesen:

11 Version 1 - Klassische Tiefensuche

12 Problem zu langsam! Wie langsam? => Summe(i=1..20, i!) Mögliche Kombinationen Was tun? Bereits besuchte Kombinationen nicht nochmal machen! Summe(i=1..20, 20 über i) = (SIC!)

13 Wie verwalten? int als Bitvector nutzen: 5 Museen 5bits benötigt War in 0, 2 und 3: (von rechts nach links lesen). Bits gezielt anschalten: | = | = Wie bekommt man => 1 << 3

14 kombination[i][j] == war ich schon mal in Museum i und habe die Kombination j bereits besucht gehabt

15 Stimmt das? Mh... Ich bin nicht so sicher...

16 Tax ICPC needs to divide it into lots. 1.land can only be divided using a sequence of land divisions; 2.a land division is an operation that divides one piece of land into two pieces of land; and 3.for each land division, a land division tax must be paid. Denoting by A the area of the largest resulting part of the division, the value of the land division tax is A×F, where F is the division tax factor.

17 Beispiel

18 Ansatz Man muss alles durchprobieren. Aber wieder schlau! => Dynamisches Programmieren: Lege Datenstruktur an, die enthält wie man eine Teilfläche am billigsten in die gewünschten Teile zerlegen kann. int[][] cost cost[a][b] == Kosten zum Zerteilen von A bis B

19

20 Grandpa

21 Magic

22 Tipps für Magic Riesige Fallunterscheidung! Einfacher mit indexOf

23 Tipps für Magic Umgekehrt ist dann auch einfacher. CharAt verwenden "ABCDEF".charAt(3) == ? "ABCDEF".indexOf('E') == ?


Herunterladen ppt "Aufgabenbesprechung Programming Contest. Order 7 Bo Pat Jean Kevin Claude William Marybeth 6 Jim Ben Zoe Joey Frederick Annabelle 0 SET 1 Bo Jean Claude."

Ähnliche Präsentationen


Google-Anzeigen