This file contains 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
property railsFolder : "/Users/asbubam/dev/rails_projects/" --update this to reflect your own location | |
global targetProjectName | |
global railsProject | |
-- Creates a new tab with the command passed to it, and sets the title accordingly | |
on newTab(tabTitle, command) | |
tell application "iTerm" to tell last terminal | |
launch session "Default" | |
tell last session | |
write text "cd " & railsProject & "/" & command |
This file contains 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
object Ex01 extends App { | |
var sum = 0 | |
for (i <- 0 until 1000) { | |
if(i % 3 == 0 || i % 5 == 0) sum = sum + i | |
} | |
println(sum) | |
} |
This file contains 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
object Ex02 extends App { | |
var index = 0 | |
var sum = 0 | |
/* | |
질문1) 여기서 아래처럼 루프를 돌리려고 했으나 에러발생 | |
var fiboResult = 0 | |
while((fiboResult = fibo(index)) <= 4000000) { | |
Ex02.scala:6: error: value <= is not a member of Unit |
This file contains 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/env ruby | |
require 'capybara-webkit' | |
require 'headless' | |
Headless.ly do | |
driver = Capybara::Driver::Webkit.new 'web_capture' | |
driver.visit 'http://www.google.co.kr' | |
driver.render 'out.png' | |
end |
This file contains 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
/* | |
어떤 수를 소수의 곱으로만 나타내는 것을 소인수분해라 하고, 이 소수들을 그 수의 >소인수라고 합니다. | |
예를 들면 13195의 소인수는 5, 7, 13, 29 입니다. | |
600851475143의 소인수 중에서 가장 큰 수를 구하세요. | |
*/ | |
object Ex03 extends App { | |
println(run(13195)) | |
println(run(600851475143L)) |
This file contains 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
/* | |
앞에서부터 읽을 때나 뒤에서부터 읽을 때나 모양이 같은 수를 대칭수(palindrome)라>고 부릅니다. | |
두 자리 수를 곱해 만들 수 있는 대칭수 중 가장 큰 수는 9009 (= 91 × 99) 입니다. | |
세 자리 수를 곱해 만들 수 있는 가장 큰 대칭수는 얼마입니까? | |
*/ | |
object Ex04 extends App { | |
var i = 100 |
This file contains 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
/* | |
1 ~ 10 사이의 어떤 수로도 나누어 떨어지는 가장 작은 수는 2520입니다. | |
그러면 1 ~ 20 사이의 어떤 수로도 나누어 떨어지는 가장 작은 수는 얼마입니까? | |
*/ | |
object Ex05 extends App { | |
var allLcm = BigInt(1) | |
for(i <- (1 to 20)) { |
This file contains 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
/* | |
1부터 10까지 자연수를 각각 제곱해 더하면 다음과 같습니다 (제곱의 합). | |
12 + 22 + ... + 102 = 385 | |
1부터 10을 먼저 더한 다음에 그 결과를 제곱하면 다음과 같습니다 (합의 제곱). | |
(1 + 2 + ... + 10)2 = 552 = 3025 | |
따라서 1부터 10까지 자연수에 대해 "합의 제곱"과 "제곱의 합" 의 차이는 3025 - 385 = 2640 이 됩니다. | |
그러면 1부터 100까지 자연수에 대해 "합의 제곱"과 "제곱의 합"의 차이는 얼마입니까? |
This file contains 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
/* | |
소수를 크기 순으로 나열하면 2, 3, 5, 7, 11, 13, ... 과 같이 됩니다. | |
이 때 10,001번째의 소수를 구하세요. | |
*/ | |
object Ex07 extends App { | |
var n = 0 | |
var count = 0 | |
while(count != 10001) { |
This file contains 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
/* | |
다음은 연속된 1000자리 숫자입니다 (읽기 좋게 50자리씩 잘라놓음). | |
73167176531330624919225119674426574742355349194934 | |
96983520312774506326239578318016984801869478851843 | |
85861560789112949495459501737958331952853208805511 | |
12540698747158523863050715693290963295227443043557 | |
66896648950445244523161731856403098711121722383113 | |
62229893423380308135336276614282806444486645238749 | |
30358907296290491560440772390713810515859307960866 |
OlderNewer