とんちゃんといっしょ

Cloudに関する技術とか日常とかについて書いたり書かなかったり

ruby

研修2日目

本日学んだこと。 C++の==は同値性を比較している。 だからstringに対して #include <iostream> #include <string> int main(){ std::string str = "hoge"; if(str == "hoge"){ std::cout << "str == hoge" << std::endl; }else{ std::cout << "str != hoge" << std::endl; } }</string></iostream>…

Rubyによるデザインパターン読書会

会社の中でお昼休みにやっているらしい読書会に参加させてもらうことに。 今回はこの本を対象に進めるらしい。Rubyによるデザイン・パターンposted with amazlet at 09.07.23Russ Olsen ラス・オルセン ピアソンエデュケーション 売り上げランキング: 9552Am…

なんか問題出されたので

http://kobin-lab.blogspot.com/2009/07/blog-post_19.html 前略 あんまり暇なので時間に余裕があるので、前みた問題考えてました。問題 以下のような出力を得るプログラムをC言語で実装。 ABCDEFGHIJKLMNOPQRSTUVWXYZ BCDEFGHIJKLMNOPQRSTUVWXYZA CDEFGHIJK…

RubyKaigi3日目

朝は角谷さんの発表から。 昨年度からRegional RubyKaigiが開かれているけど、 私としてはKOFで行われた1個にしか参加できていなくて残念。 関東に来てからはRubyの各コミュニティが東京とか栃木にあったり、 平日の晩に開かれていて千葉からは行きにくい・…

RubyKaigi2日目

午前中はずっと一橋記念講堂で話を聞いてた。 Yuguiさんの話の裏はujihisaさんだったがそっちを諦めて Yuguiさんの話を聞いたが面白かった。 ujihisaさんのは後でニコニコ動画に上がったらコメントつきで見る予定。 Yuguiさんのあとはokkezさんの話を聞いて…

RubyKaigi1日目

起きたら電気とエアコンがつきっぱなしの状態からスタート。 昨日お酒飲みながらホライゾン読んでて意識がなくなったらしい。 まだ5時だったのでとりあえず寝なおしてから行動開始。 今日は夏休みを1日消化しているので、 朝ミーティングの時間に起きたり朝…

Reject懇親会@RubyKaigi

ことの始まり id:repeatedlyと2人でTwitter上で 「RubyKaigiの懇親会行けないねー」 「どうしようか?」 「行けない組で懇親会とかしてみるか?」 「じゃあそれで!」 的な流れでやることになったイベント。 詳細が決まったので載せておく。 内容 日程 : 200…

研修受けてきた

本日は1日研修。 VMPlayer上でCentOS動かしていたのでプログラムが動く環境だ! Ruby入ってないし・・・ Pythonが入っていたので軽く触ってみた。 >>> print"Hello World!" Hello World! print関数があるけどputs関数がないので微妙。 あとよく聞くインデン…

RubyKaigi2009

お昼休みに無事にチケット取ったどー! これで7/17に夏休みを使った意味が出来た。 よし、Reject懇親会も頑張ろう。 とりあえず、他の幹事と連携取りながら人数と場所の調整をせねば・・・ 楽しくなってきた。

研修中にFizzBuzz

研修の暇つぶしでJavaでFizzBuzzをGolf class A{static{for(int i=0;i<101;System.out.println(++i%3<1?i%5<1?"FizzBuzz":"Fizz":i%5<1?"Buzz":i));}} 確かこんな感じ。 100Byteが切れずに一人でうんうん唸ってた。 最終的には周りを何人か巻き込んで考えた…

Problem 14

問題 Find the longest sequence using a starting number under one million.

Problem 13

問題 Find the first ten digits of the sum of one-hundred 50-digit numbers.

Problem 12

問題 What is the value of the first triangle number to have over five hundred divisors?

Problem 11

問題 What is the greatest product of four numbers on the same straight line in the 20 by 20 grid?

Problem 10

問題 Calculate the sum of all the primes below two million.

Problem 9

問題 Find the only Pythagorean triplet, {a, b, c}, for which a + b + c = 1000.

Problem 8

問題 Discover the largest product of five consecutive digits in the 1000-digit number.

Problem 7

問題 Find the 10001st prime. 英語 By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6^(th) prime is 13.What is the 10001^(st) prime number? http://projecteuler.net/index.php?section=problems&id=7 日本語 素…

Problem 6

問題 What is the difference between the sum of the squares and the square of the sums? 英語 The sum of the squares of the first ten natural numbers is, 1^(2) + 2^(2) + ... + 10^(2) = 385The square of the sum of the first ten natural number…

Problem 5

問題 What is the smallest number divisible by each of the numbers 1 to 20? 英語 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.What is the smallest number that is evenly divisible …

Problem 4

問題 Find the largest palindrome made from the product of two 3-digit numbers. 英語 A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.Find the largest palin…

Problem 3

問題 Find the largest prime factor of a composite number. 英語 The prime factors of 13195 are 5, 7, 13 and 29.What is the largest prime factor of the number 600851475143 ? http://projecteuler.net/index.php?section=problems&id=3 日本語 1319…

Problem 2

問題 Find the sum of all the even-valued terms in the Fibonacci sequence which do not exceed four million. 英語 Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 t…

Problem 1

問題 Add all the natural numbers below one thousand that are multiples of 3 or 5. 英語 If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.Find the sum of all the…

そういえば勉強会で聞いた気もするな

Project EulerのProblem12で素因数分解の問題を解いていたが、 非常に時間がかかって仕方がないので、素因数分解の高速化とメモ化について調べていた。 フェルマーの定理を使えば素因数分解の高速化できるというところまで調べたときに、 Rubyには素因数分解…

エラトステネスの篩2

昨日に続いてエラトステネスの篩の話 昨日見つけたソースコードを見てるとどうしてもパフォーマンスが気になったので測定してみた。 require 'benchmark' Benchmark.bm do |x| x.report("My Primes:") { prime = [2] # 最初は 2 だけ 3.step(1e6, 2) do |i| …

エラトステネスの篩

息抜きにProject Eulerしてたら2百万以下の素数表が必要になったのだが、 mathn.rb内にあるPrime#succを使ってるといつまでたっても計算結果が返ってこない。 Prime#succのソースコード読んだら確かに遅そうだったので、 エラトステネスの篩を実装してみるこ…

トークセッションに行ってきた

毎日コミュニケーションズ刊 『Rubyで作る奇妙なプログラミング言語 〜Esoteric Language〜』刊行記念 「Rubyで作る奇妙なプログラミング言語の世界」 のトークセッションに行ってきた。 昼前にPascalと堂島アバンザの前で待ち合わせて、カレーを食べて店内…

第31回 Ruby/Rails勉強会@関西にいます

遅刻してメイドめーるの最後の方に到着した・・・ 「メイドめーる」メイドさんはこうやって働いている! by 大怪獣もぎゃさん 萌えコンテンツは大変らしい 遅れたから技術的な話聞き逃して残念・・・ 整数論の問題に Ruby を活用してみる by こなみさん 自然…

autospec + Growl

autotestがうまく動かないのでソースコード読もうとしたら、同一フォルダ内にautospecなるもの発見。 ぐぐったらこっちでRSpecが動くらしい。 今までの苦労はなんだったんだ・・・ とりあえず、あとでまとめを書こう。