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.

## 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:

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 Marybeth William Kevin Pat SET 2 Jim Zoe Frederick Annabelle Joey Ben

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.

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

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".

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.

Longnight

Einlesen:

Version 1 - Klassische Tiefensuche

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

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

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

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

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.

Beispiel

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

Grandpa

Magic

Tipps für Magic Riesige Fallunterscheidung! Einfacher mit indexOf

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