COCI 2016/2017 Tasks Bridž Kartomat Kas Rekonstruiraj Rima Osmosmjerka Total

Similar documents
Activity 1: Play comparison games involving fractions, decimals and/or integers.

March 5, What is the area (in square units) of the region in the first quadrant defined by 18 x + y 20?

BLACKJACK. Game Rules. Definitions Mode of Play How to Play Settlement Irregularities

LET S PLAY PONTOON. Pontoon also offers many unique payouts as well as a Super Bonus of up to $5000 on certain hands.

COCI 2017/2018. Round #1, October 14th, Tasks. Task Time limit Memory limit Score. Cezar 1 s 64 MB 50. Tetris 1 s 64 MB 80

CS 210 Fundamentals of Programming I Fall 2015 Programming Project 8

Acing Math (One Deck At A Time!): A Collection of Math Games. Table of Contents

CS 210 Fundamentals of Programming I Spring 2015 Programming Assignment 8

18.S34 (FALL, 2007) PROBLEMS ON PROBABILITY

LEARN HOW TO PLAY MINI-BRIDGE

4.1 Sample Spaces and Events

Chapter 2 Integers. Math 20 Activity Packet Page 1

CS Programming Project 1

November 11, Chapter 8: Probability: The Mathematics of Chance

Math 1111 Math Exam Study Guide

CSCI 4150 Introduction to Artificial Intelligence, Fall 2004 Assignment 7 (135 points), out Monday November 22, due Thursday December 9

Live Casino game rules. 1. Live Baccarat. 2. Live Blackjack. 3. Casino Hold'em. 4. Generic Rulette. 5. Three card Poker

A. Rules of blackjack, representations, and playing blackjack

November 6, Chapter 8: Probability: The Mathematics of Chance

Sec 5.1 The Basics of Counting

Make better decisions. Learn the rules of the game before you play.

Chapter 2. Permutations and Combinations

2.5 Sample Spaces Having Equally Likely Outcomes

BRIDGE is a card game for four players, who sit down at a

TASK JACK PROZORI ZAGRADE REZ PASTELE KOŠARE. zagrade.pas zagrade.c zagrade.cpp. time limit 1 second 1 second 1 second 1 second 5 seconds 2 second

TASK FUNGHI ZMIJA TRAKTOR ZGODAN JABUKE DIVLJAK. standard input (stdio) standard output (stdout)

Croatian Open Competition in Informatics, contest 5 February 23, 2008

More Probability: Poker Hands and some issues in Counting

Chapter 5: Probability: What are the Chances? Section 5.2 Probability Rules

Math 1111 Math Exam Study Guide

To play the game player has to place a bet on the ANTE bet (initial bet). Optionally player can also place a BONUS bet.

1. Definitions 2. Mode of Play 3. How to Play 4. Settlement 5. Irregularities

TASK BELA PUTOVANJE PIANINO PAROVI KRUMPIRKO SAN. standard input (stdin) standard output (stdout)

Math-Essentials. Lesson 9-2: Counting Combinations

HOW TO PLAY BLACKJACK

MATH 215 DISCRETE MATHEMATICS INSTRUCTOR: P. WENG

1. An office building contains 27 floors and has 37 offices on each floor. How many offices are in the building?

Section Introduction to Sets

ACM International Collegiate Programming Contest 2010

Counting Methods and Probability

Algebra II- Chapter 12- Test Review

{ a, b }, { a, c }, { b, c }

Up & Down GOAL OF THE GAME UP&DOWN CARD A GAME BY JENS MERKL & JEAN-CLAUDE PELLIN ART BY CAMILLE CHAUSSY

Reading 14 : Counting

COMPOUND EVENTS. Judo Math Inc.

1) = 10) 4-15 = 2) (-4)(-3) = 11) = 4) -9 6 = 13) = 5) = 14) (-3)(15) = = 15) 7) = 16) -7 (-18) =

November 8, Chapter 8: Probability: The Mathematics of Chance

A UNIQUE COMBINATION OF CHANCE & SKILL.

Pan (7:30am) Juan (8:30am) Juan (9:30am) Allison (10:30am) Allison (11:30am) Mike L. (12:30pm) Mike C. (1:30pm) Grant (2:30pm)


Today s Topics. Sometimes when counting a set, we count the same item more than once

SALES AND MARKETING Department MATHEMATICS. Combinatorics and probabilities. Tutorials and exercises

Fundamentals of Probability

The student will explain and evaluate the financial impact and consequences of gambling.

CHAPTER 649a. THREE CARD POKER

6.1 Basics of counting

After receiving his initial two cards, the player has four standard options: he can "Hit," "Stand," "Double Down," or "Split a pair.

CROATIAN OPEN COMPETITION IN INFORMATICS. 4th round

CARIBBEAN. The Rules

Activity 3: Combinations

The game of poker. Gambling and probability. Poker probability: royal flush. Poker probability: four of a kind

Probability. The MEnTe Program Math Enrichment through Technology. Title V East Los Angeles College

The Teachers Circle Mar. 20, 2012 HOW TO GAMBLE IF YOU MUST (I ll bet you $5 that if you give me $10, I ll give you $20.)

Math Games Played with Cards and Dice (K-3)

Honors Precalculus Chapter 9 Summary Basic Combinatorics

COCI 2008/2009 Contest #3, 13 th December 2008 TASK PET KEMIJA CROSS MATRICA BST NAJKRACI

Problem A. Jumbled Compass

Jong C. Park Computer Science Division, KAIST

THE NUMBER WAR GAMES

Counting Poker Hands

The 2012 ACM-ICPC Asia Regional Contest Chengdu Site

GAMBLING ( ) Name: Partners: everyone else in the class

PROBLEM SET 2 Due: Friday, September 28. Reading: CLRS Chapter 5 & Appendix C; CLR Sections 6.1, 6.2, 6.3, & 6.6;

how TO PLAY blackjack

4.3 Rules of Probability

The Exciting World of Bridge

Activity 6: Playing Elevens

1. Eighty percent of eighty percent of a number is 144. What is the 1. number? 2. How many diagonals does a regular pentagon have? 2.

Review. Natural Numbers: Whole Numbers: Integers: Rational Numbers: Outline Sec Comparing Rational Numbers

Players try to obtain a hand whose total value is greater than that of the house, without going over 21.

The 2016 ACM-ICPC Asia China-Final Contest Problems

TASK ŠEĆER KOLO GITARA POŠTAR KUGLICE UPIT. kolo.pas kolo.c kolo.cpp. gitara.pas gitara.c gitara.cpp

3 The multiplication rule/miscellaneous counting problems

No Flop No Table Limit. Number of

HEADS UP HOLD EM. "Cover card" - means a yellow or green plastic card used during the cut process and then to conceal the bottom card of the deck.

BLACKJACK Perhaps the most popular casino table game is Blackjack.

Whatcom County Math Championship 2017 Probability + Statistics 4 th Grade

CSE 1400 Applied Discrete Mathematics Permutations

M146 - Chapter 5 Handouts. Chapter 5

Whatcom County Math Championship 2016 Individual 4 th Grade

CS100: DISCRETE STRUCTURES. Lecture 8 Counting - CH6

COUNTING AND PROBABILITY

Buster Blackjack. BGC ID: GEGA (October 2011)

Bridge Players: 4 Type: Trick-Taking Card rank: A K Q J Suit rank: NT (No Trumps) > (Spades) > (Hearts) > (Diamonds) > (Clubs)

Here are two situations involving chance:

Problems from 9th edition of Probability and Statistical Inference by Hogg, Tanis and Zimmerman:

CSEP 573 Applications of Artificial Intelligence Winter 2011 Assignment 3 Due: Wednesday February 16, 6:30PM

Intermediate Math Circles November 1, 2017 Probability I

NUMB3RS Activity: A Bit of Basic Blackjack. Episode: Double Down

Combinational Mathematics - I

Transcription:

Tasks Task Time limit Memory limit Score Bridž 1 s 32 MB 50 Kartomat 1 s 32 MB 80 Kas 2 s 512 MB 100 Rekonstruiraj 2 s 128 MB 120 Rima 1 s 256 MB 10 Osmosmjerka s 256 MB 160 Total 650

Task Bridž 1 s / 32 MB / 50 points After a few months of playing on his new phone, Mirko has finally decided to find a new hobby. He discovered a card game called bridge! It is known that bridge is played by four players using a 52-card deck, suits total (clubs, hearts, diamonds and spades) and 13 values (A, K, Q, J, 10, 9, 8, 7, 6, 5,, 3 and 2). At the beginning of the game, each player is dealt 13 cards. Before starting the game, each player counts their so-called honor points in the following way: - each ace (A) is worth points - each king (K) is worth 3 points - each queen (Q) is worth 2 points - each jack (J) is worth 1 point - the remaining cards (that will be denoted with X in this task) are worth 0 points. Given the fact that Mirko has started playing bridge only recently, he has decided to practice couting points. He dealt himself cards N times and each time counted his honor points. In the end, he added them up. He wants to know if he s done a good job. Help Mirko and check! INPUT The first line of input contains the integer N (1 N 10 000) from the task. Each of the following N lines contains Ki, a string consisting of characters A, K, Q, J, X, th of length 13, representing the cards Mirko had in his hand after dealing them for the i time. OUTPUT The first and only line of output must contain the required sum from the task. SAMPLE TESTS input 1 AKXAKJXXXAXAQ input XXXAXXXXXXJXX KXAXXXQJAXXXX AQKQXXXKXXKQX JXXXXXJXXXXXX output output 25 0

Task Bridž 1 s / 32 MB / 50 points Clarification of the first test case: Mirko has a total of aces, 2 kings, 1 queen and 1 jack in his hand. This totals to * + 2 * 3 + 1 * 2 + 1 * 1 = 25 honor points.

Task Kartomat 1 s / 32 MB / 80 points A ticket machine is a device similar to an ATM and was introduced by Croatian Railways in order to make purchasing train tickets easier. The first step in buying a ticket is choosing the destination of your journey. The destination can be one of N destinations offered in advance, names of local and worldwide places. You choose your destination by typing its name letter by letter. By entering each additional letter, the number of possible destinations reduces. The initial appearance of the keyboard on the screen is shown in the picture. We will represent it as four arrays of characters of length 8. ***ABCDE FGHIJKLM NOPQRSTU VWXYZ*** After choosing each letter, the keyboard changes its appearance. Only letters that can be chosen in the next step are left active (depending on the destinations still possible to choose). The remaining letter that can t be chosen are replaced with the character *. Write a programme that will, for N given destinations and the first few letters (not all of them) of the chosen destination, output the appearance of the keyboard before entering the next letter. You will never be given the entire word. INPUT The first line contains the integer N (1 N 50) from the task. Each of the following N lines contains one string of at most 100 characters that contains only uppercase letters of the English alphabet. The last line contains the string that represents the first few letters of the chosen destination. OUTPUT You must output the appearance of the keyboard described in the task. SAMPLE TESTS input input input ZAGREB SISAK ZADAR ZABOK SPLIT VINKOVCI NOVSKA RIJEKA AAAABCD AAAABCA AAAACDE AAAAAAA

Task Kartomat 1 s / 32 MB / 80 points ZA VINKO AAAA output output output ****B*D* *G****** V******* ***ABC** Clarification of the first test case: After entering the letters ZA, the third letter can be G if we want a ticket to Zagreb, D if we want a ticket to Zadar, and B if we want a ticket to Zabok.

Task Kas 2 s / 512 MB / 100 points Kile and Pogi have found N banknotes on the street. After making sure that the original owner is nowhere to be found, they decided to split the banknotes amongst themselves. In the end they want to win the same amount of money so they split the banknotes in such a way. Of course, the sum of the banknotes nobody ends up having is the least possible one. Since they couldn t just leave the remaining banknotes on the street, they decided to go to a nearby casino and put everything on red, hoping that they would end up getting twice the money they bet. The roulette decided on the (lucky, for this time) number 13 and our heroes decided to split the money they won. The payout is such that Kile and Pogi will always be able to split the money they won into two equal parts. Because of the immense adrenaline rush, the boys have lost their mathematical abilities. Help them figure out how much money each of them is taking home. INPUT The first line of input contains the integer N (1 N 500) that denotes the number of banknotes on the street. Each of the following N lines contains a single positive integer ci that denotes the value of the i th banknote in kunas (kn). The total sum of money will not exceed 100 000 kn. OUTPUT You must output the amount of money each of them took home. SCORING In test cases worth 50 points total, N will be less than or equal to 13. In test cases worth 70 points total, N will be less than or equal to 50, and the total sum of money will be at most 1000 kn. SAMPLE TESTS input 2 3 1 6 input 5 2 3 5 8 13 output output 6 18

Task Kas 2 s / 512 MB / 100 points Clarification of the first test case: Kile took banknotes worth 2, 3 and 1 kn, and Pogi took the banknote worth 6 kn. Clarification of the second test case: Kile took the banknotes worth 5 and 8 kn, and Pogi took the banknote worth 13 kn. The remaining banknotes are worth 2 and 3 kn, which the boys have doubled in the casino. The total earnings of each of them is 13 + 5 = 18 kn.

Task Rekonstruiraj 2 s / 128 MB / 120 points Mirko has written down N real numbers with finite decimal notation. Next, for each number, he wrote down the arithmetic sequence that begins with 0 and its difference is the current number. For example, if the current number is x, the corresponding arithmetic sequence will be 0, x, 2 x, 3 x, x, On another piece of paper, Mirko has written down all members of all obtained N sequences that are in the interval [A, B], sorted in ascending order, removing possible duplicates. The next day, he seems to have lost the first paper and wants to reconstruct the initial numbers based on the second piece of paper. Help him! INPUT The first line of input contains a natural number K, smaller than or equal to 50, the number of different elements in Mirko s sequences in the interval [ A, B]. The second line contains integers A and B (1 A < B 10 6 ). Each of the following K lines contains the K described numbers, sorted in ascending order. These will be real numbers with at most 5 decimal places. OUTPUT You must output N lines, where N is the size of Mirko s set of initial numbers, containing Mirko s (mutually distinct) initial numbers, in any order. If multiple possible sets exist, output the one containing the smallest amount of numbers (the one with the smallest N), and if there are multiple such sets, output any. SCORING In test cases worth 50% of total points, all numbers in the input will be natural. SAMPLE TESTS input 1 2 1 1. 1.5 2 input 5 10 25 12 13.5 18 20.25 2 output output 0.5 6.0

Task Rekonstruiraj 2 s / 128 MB / 120 points 0.7 6.75 Clarification of the first example: Another correct solution is {0.5, 1.}.

Task Rima 1 s / 256 MB / 10 points Little Adrian is a fan of rhyme. He believes that two words rhyme if and only if their longest common suffix is as long as the longer of the two words, or shorter than the longer word by 1. In other words, A and B rhyme if and only if it holds L CS(A, B) m ax( A, B ) 1. One day, while reading a collection of short stories, he decided to compose the longest possible sequence of words such that each two consecutive words rhyme. Each word from the sequence can appear only once. Adrian has grown tired of this task, so he decided to go back to reading, and is asking you to solve this task instead of him. INPUT The first line of input contains the integer N (1 N 500 000). Each of the following N lines contains one word consisting of lowercase letters of the English alphabet. All words are mutually distinct, and their total length is at most 3 000 000. OUTPUT You must output the length of the longest sequence. SCORING In test cases worth 30% of points, it will hold N 18. SAMPLE TESTS input input input honi toni oni ovi 5 ask psk krafna sk k 5 pas kompas stas s nemarime output output output 3 1 Clarification of the second test case: The only possible sequence is ask-psk-sk-k. Clarification of the third test case: No two words rhyme.

Task Osmosmjerka s / 256 MB / 160 points We have created an infinite eight-directional crossword by taking a letter-filled block of dimensions M x N and infinitely repeating it. For instance, if we are given the following block: then we create the following crossword: that is inifinite in all directions. honi hsin...honihonihonihoni......hsinhsinhsinhsin......honihonihonihoni......hsinhsinhsinhsin... In the created crossword, we randomly choose a field and one of eight directions, then write down a word of length K obtained by reading the crossword starting from the initial field, in the chosen direction. If we executed this query twice (independently), we would obtain two words of length K. Calculate the probability that the two words are equal. INPUT The first line of input contains integers M, N, K from the task (1 M, N 500, 2 K 10 9 ). Each of the following M lines contains N lowercase letters of the English alphabet, and describes a block of the crossword. At least two distinct letters will exist in the block. OUTPUT You must output the required probability in the form of a reduced fraction p/q, without spaces. SCORING In test cases worth 100 total points, it will hold M = N. SAMPLE TESTS input input input 1 2 2 ab 2 3 honi hsin 3 3 10 ban ana nab output output output

Task Osmosmjerka s / 256 MB / 160 points 5/16 19/512 2/27