본문 바로가기

problem solving/Problem Solving

Google Code Jam 2009 - Round1C 복습 http://code.google.com/codejam/contest/dashboard?c=189252# A. All Your Base 기원전 2100년, 어떤 외계인이 지구에와 자신의 언어로 지구와의 전쟁까지 남은 시간을 기록했다. 이 외계인의 언어의 각 심볼은 하나의 숫자와 대응되는 것으로 보인다. 예를 들어 'ab2ac999'는 10진수로 '31536000'과 대응될지도 모른다. 하지만 불행하게도 우리는 이 외계인이 사용하는 진수와 각 심볼이 정확히 어떤 숫자와 대응되는지 알 수 없다. 그래서 우리는 외계인이 쓴 암호문이 나타낼 수 있는 최소한의 숫자를 알고 싶다. The answer will never exceed 1018 가능한 최소의 숫자를 구하므로 base가 최소가 되야한다. base의 하한.. 더보기
Google Code Jam 2009 - Round1B 복습 http://code.google.com/codejam/contest/dashboard?c=186264# A.Decision Tree Decision Tree가 아래의 포맷으로 주어진다. (0.2 furry (0.81 fast (0.3) (0.2) ) (0.1 fishy (0.3 freshwater (0.01) (0.01) ) (0.1) ) ) 좀 더 문법적으로 설명하면 주어지는 Tree는 아래의 정규식 문법을 따른다 tree ::= (weight [feature tree tree]) weight is a real number between 0 and 1, inclusive feature is a string of 1 or more lower case English letters 이 Decision T.. 더보기
Google Code Jam 2009 - Round1A 복습 http://code.google.com/codejam/contest/dashboard?c=188266# A. Multi-base happiness 숫자의 각 다지트의 제곱합을 구하여 반복, 반복 해서 결국 1이 나오면 행복한 숫자란다. 예를 들어 10진수 82는 아래와 같이 행복한 숫자임을 알 수 있다. 8*8 + 2*2 = 64 + 4 = 68, repeat: 6*6 + 8*8 = 36 + 64 = 100, repeat: 1*1 + 0*0 + 0*0 = 1 + 0 + 0 = 1 (happy! :) 주어진 모든 base에 대해 행복한 숫자가 되는 가장 작은 수를 찾아 10진수로 출력하라. Limits 2 ≤ all possible input bases 10 숫자 2부터 차례대로 각 base에 대해 ha.. 더보기
Tight words http://acm.pku.edu.cn/JudgeOnline/problem?id=2537 Description Given is an alphabet {0, 1, ... , k}, 0 더보기
Freckles http://acm.pku.edu.cn/JudgeOnline/problem?id=2560 Description In an episode of the Dick Van Dyke show, little Richie connects the freckles on his Dad's back to form a picture of the Liberty Bell. Alas, one of the freckles turns out to be a scar, so his Ripley's engagement falls through. Consider Dick's back to be a plane with freckles at various (x,y) locations. Your job is to tell Richie how to.. 더보기
Vase collection http://acm.pku.edu.cn/JudgeOnline/problem?id=1632 Description Mr Cheng is a collector of old Chinese porcelain, more specifically late 15th century Feng dynasty vases. The art of vase-making at this time followed very strict artistic rules. There was a limited number of accepted styles, each defined by its shape and decoration. More specifically, there were 36 vase shapes and 36 different patter.. 더보기
Bridging signals http://acm.pku.edu.cn/JudgeOnline/problem?id=1631 Description 'Oh no, they've done it again', cries the chief designer at the Waferland chip factory. Once more the routing designers have screwed up completely, making the signals on the chip connecting the ports of two functional blocks cross each other all over the place. At this late stage of the process, it is too expensive to redo the routing.. 더보기
Kadj Squares http://acm.pku.edu.cn/JudgeOnline/problem?id=3347 Description In this problem, you are given a sequence S1, S2, ..., Sn of squares of different sizes. The sides of the squares are integer numbers. We locate the squares on the positive x-y quarter of the plane, such that their sides make 45 degrees with x and y axes, and one of their vertices are on y=0 line. Let bi be the x coordinates of the bo.. 더보기
Party at Hali-Bula http://acm.pku.edu.cn/JudgeOnline/problem?id=3342 Description Dear Contestant, I'm going to have a party at my villa at Hali-Bula to celebrate my retirement from BCM. I wish I could invite all my co-workers, but imagine how an employee can enjoy a party when he finds his boss among the guests! So, I decide not to invite both an employee and his/her boss. The organizational hierarchy at BCM is su.. 더보기
Barbara Bennett's Wild Numbers http://acm.pku.edu.cn/JudgeOnline/problem?id=3340 Description A wild number is a string containing digits and question marks (like 36?1?8). A number X matches a wild number W if they have the same length, and every non-question mark character in X is equal to the character in the same position in W (it means that you can replace a question mark with any digit). For example, 365198 matches the wi.. 더보기