본문 바로가기

Algorithm8

Problem 19 - Counting Sundays You are given the following information, but you may prefer to do some research for yourself. 1 Jan 1900 was a Monday. Thirty days has September, April, June and November. All the rest have thirty-one, Saving February alone, Which has twenty-eight, rain or shine. And on leap years, twenty-nine. A leap year occurs on any year evenly divisible by 4, but not on a century unless it is divisible by 4.. 2020. 12. 14.
Problem 17 - Number letter counts (2) 이번에는 기존의 문제를 좀 뒤틀어서 생각해 보겠습니다. 기존 문제는 요약을 하자면 내가 원하는 범위의 숫자에 대해서 알파벳으로 전환하여 그 길이를 모두 더한 결과를 출력하는 문제였습니다. 그렇다면, 기왕해보는 김에 숫자를 입력하면 string으로 출력해주는 프로그램을 만들어 보면 어떨까요?? 이름하여, 숫자에 대한 문자변환기... 가 되는것이죠. 숫자 1 ~ 5에 대해서 문자로 변환하면, 말 그대로 One, Two, Three, Four, Five 로 변환이 되게 됩니다. 그렇다면, 어마어마하게 큰 숫자는 어떻게 변환이 가능할까요?? 예를들어, 104382426112라는 숫자가 있다면... 10조이상에 해당하는 숫자로... 영문자로 변환을 한다면, One Hundred Four Billion Three .. 2020. 12. 10.
Problem 18 - Maximum path sum I By starting at the top of the triangle below and moving to adjacent numbers on the row below, the maximum total from top to bottom is 23. 3 7 4 2 4 6 8 5 9 3 That is, 3 + 7 + 4 + 9 = 23. Find the maximum total from top to bottom of the triangle below: 75 95 64 17 47 82 18 35 87 10 20 04 82 47 65 19 01 23 75 03 34 88 02 77 73 07 63 67 99 65 04 28 06 16 70 92 41 41 26 56 83 40 80 70 33 41 48 72 33.. 2020. 12. 9.
Problem 17 - Number letter counts (1) If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total. If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many letters would be used? NOTE: Do not count spaces or hyphens. For example, 342 (three hundred and forty-two) contains 23 letters and 115 (one hundred and fifteen) con.. 2020. 12. 8.