This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
n과 d가 양의 정수이고 n<d인 분수 n/d을 GCD(n, d) = 1일 때 기약 진분수라고 부르기로 합니다. | |
d ≤ 8 인 기약 진분수들을 커지는 순으로 늘어놓으면 아래와 같습니다. | |
1/8, 1/7, 1/6, 1/5, 1/4, 2/7, 1/3, 3/8, 2/5, 3/7, 1/2, 4/7, 3/5, 5/8, 2/3, 5/7, 3/4, 4/5, 5/6, 6/7, 7/8 | |
위에서 보듯이 3/7의 바로 앞에는 2/5가 오게 됩니다. | |
d ≤ 1,000,000 인 기약 진분수들을 커지는 순으로 늘어놓았을 때, 3/7 바로 앞에 오는 수의 분자는 얼마입니까?""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
삼각수, 사각수, 오각수 같은 다각수들은 아래의 공식으로 만들 수 있습니다. | |
삼각수 P3,n = n(n+1)/2 1, 3, 6, 10, 15, ... | |
사각수 P4,n = n2 1, 4, 9, 16, 25, ... | |
오각수 P5,n = n(3n−1)/2 1, 5, 12, 22, 35, ... | |
육각수 P6,n = n(2n−1) 1, 6, 15, 28, 45, ... | |
칠각수 P7,n = n(5n−3)/2 1, 7, 18, 34, 55, ... | |
팔각수 P8,n = n(3n−2) 1, 8, 21, 40, 65, ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
아래와 같은 5×5 행렬이 있습니다. 좌측 상단에서 출발하고 오른쪽이나 아래로만 움직이면서 우측 하단까지 가는 경로의 합을 구해 보면, 빨갛게 표시된 경로가 2427로서 가장 작습니다. | |
131 673 234 103 18 | |
201 96 342 965 150 | |
630 803 746 422 111 | |
537 699 497 121 956 | |
805 732 524 37 331 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""정수 좌표계 상에서 두 점 P (x1, y1) 와 Q (x2, y2) 를 잡고 원점 O(0,0)와 이으면 삼각형 ΔOPQ가 만들어집니다. | |
x, y 좌표값이 0과 2 사이일 때, 즉 0 ≤ x1, y1, x2, y2 ≤ 2 일 때 만들 수 있는 삼각형 중에서 직각삼각형은 모두 14개입니다. | |
0 ≤ x1, y1, x2, y2 ≤ 50 일 때는 직각삼각형이 모두 몇 개나 만들어질까요? """ | |
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
아래와 같은 20×20 격자가 있습니다. | |
08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08 | |
49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00 | |
81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13 36 65 | |
52 70 95 23 04 60 11 42 69 24 68 56 01 32 56 71 37 02 36 91 | |
22 31 16 71 51 67 63 89 41 92 36 54 22 40 40 28 66 33 13 80 | |
24 47 32 60 99 03 45 02 44 75 33 53 78 36 84 20 35 17 12 50 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#coding: utf8 | |
""" | |
프로젝트 오일러 82번 문제도 폭우선검색을 이용해서 | |
최단거리를 찾는데, 여기서는 움직일 수 있는 방향이 총 3개이며, | |
서로 아래/위에 위치한 꼭지점들은 각각 서로를 향해 갈 수 있고, | |
이는 각 꼭지점이 "이웃"의 관계를 통해서 서로에게 강한 참조를 1개씩 갖는다는 것을 의미한다. | |
그리고 이는 곧 객체가 메모리상에서 누수됨을 뜻한다. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Contacts | |
func update() | |
{ | |
func makeNickname(name: String) -> String | |
{ | |
let transform: UnicodeScalar -> String = { u in | |
let c = Int(u.value) | |
guard case 0xac00...0xd7a3 = c else { return "" } | |
return String(UnicodeScalar((c - 0xac00) / 28 / 21 + 0x1100)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/swift | |
import Contacts | |
func update() | |
{ | |
func makeNickname(name: String) -> String | |
{ | |
let transform: UnicodeScalar -> String = { u in | |
let c = Int(u.value) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
class ClockView: UIView { | |
let loadDate: NSDate | |
override init(frame: CGRect){ | |
loadDate = NSDate() | |
super.init(frame: frame) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* FizzBuzz in swift */ | |
for x in 1...100 { | |
switch (x % 3, x % 5) { | |
case (0, 0): | |
print("FizzBuzz") | |
case (0, _): | |
print("Fizz") | |
case (_, 0): | |
print("Buzz") |