- hoge
- ho
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
require 'rubygems' | |
require 'simple-rss' | |
rss = SimpleRSS.new( ARGF.read ) | |
count = 0 | |
f = nil | |
rss.items.each do |item| | |
if ( count % 30 == 0 ) |
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
irb(main):001:0> def f1( x, y ) | |
irb(main):002:1> yield( 1, 2, x, y ) | |
irb(main):003:1> end | |
=> nil | |
irb(main):004:0> f1( 1,2 ) | |
LocalJumpError: no block given | |
from (irb):2:in `f1' | |
from (irb):4 | |
from :0 | |
irb(main):005:0> f1( 1, 2 ) do |a,b,c,d| a+b+c+d 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
irb(main):001:0> def f1( x, y ) | |
irb(main):002:1> yield( 1, 2, x, y ) | |
irb(main):003:1> end | |
=> nil | |
irb(main):004:0> f1( 1,2 ) | |
LocalJumpError: no block given | |
from (irb):2:in `f1' | |
from (irb):4 | |
from :0 | |
irb(main):005:0> f1( 1, 2 ) do |a,b,c,d| a+b+c+d 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
/* | |
* understandpointer.c by Daisuke Nakamura | |
* | |
* ポインタの概念をわかるためのプログラム | |
* | |
* ポインタがわかりにくいのは、ポインタ関連の演算子が | |
* いろんな意味で使われていて | |
* ややこしいからだ。たとえば、変数の宣言で | |
* int *ptr; | |
* と書いたときの'*'と、文中で |
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
/* | |
* understandpointer.c by Daisuke Nakamura | |
* | |
* ポインタの概念をわかるためのプログラム | |
* | |
* ポインタがわかりにくいのは、ポインタ関連の演算子が | |
* いろんな意味で使われていて | |
* ややこしいからだ。たとえば、変数の宣言で | |
* int *ptr; | |
* と書いたときの'*'と、文中で |
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
javascript:(function(){var d=document,w=window,t=(d.selection)?d.selection.createRange().text:(w.getSelection)?w.getSelection():(d.getSelection)?d.getSelection():'';w.open('http://www.google.com/search?q=define:'+encodeURIComponent(t));})(); |
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
#!ruby | |
# -*- coding: utf-8 -*- | |
# | |
# 二次元配列の一次元目の全ての組み合わせを作りたい。 | |
# 配列の大きさは実行時にしかわからない。 | |
# | |
a = [ | |
%w(a b c), | |
%w(x y z), |
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
#!ruby | |
$base = 26 | |
def string_to_number( str ) | |
b = 1 | |
number = 0 | |
str.reverse.each_byte do |c| | |
unit = (c-?A+1) | |
number += unit * b |
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
k = gets.split[1].to_i | |
scores = gets.split.map{|e| e.to_i } | |
t = scores[k] | |
t = 1 if t == 0 | |
puts scores.count{|e| e >= t} |
OlderNewer