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
# encoding: utf-8 | |
class LineItem < ActiveRecord::Base | |
attr_accessible :product,:cart_id,:product_id | |
belongs_to :product | |
belongs_to :cart | |
end |
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
require './fib_map' | |
@fib_map = FibMap.new(100) | |
(0..100).each {|item| | |
if @fib_map.fibonacci?(item) then | |
p 'HENTAI!' | |
else | |
p item | |
end |
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
def baseInt = 0 | |
def addInt = 1 | |
Closure fibonacci = { | |
println baseInt | |
def nextBase = addInt | |
def nextAdd = baseInt + addInt | |
baseInt = nextBase | |
addInt = nextAdd | |
} |
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
def fibonacci() = { | |
var baseInt = 0 | |
var addInt = 1 | |
() => { | |
val nextBase = addInt | |
val nextAdd = baseInt + addInt | |
baseInt = nextBase | |
addInt = nextAdd | |
} | |
println(baseInt) |
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
using System; | |
using System.Collections.Generic; | |
namespace yhpg4 | |
{ | |
class MainClass | |
{ | |
public static void Main (string[] args) | |
{ | |
TetrominoChecker checker = new TetrominoChecker(); |
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
ans = 0 | |
for (int i: 100 .. 999) { | |
for (int j: i .. 999) { | |
m = i * j | |
str = m.toString() | |
reverseStr = str.reverse() | |
if (str == reverseStr) { | |
kaibun = str.toInteger() | |
if (ans < kaibun) { |
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
b = 2 | |
while(true) { | |
canDiv = true | |
for (int i: 2 .. 20) { | |
if (b % i) { | |
canDiv = false | |
break | |
} | |
} | |
if (canDiv) { |
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
sum1 = 0 | |
for (int i: 1..100) { | |
sum1 += i**2 | |
} | |
sum2 = 0 | |
for (int j: 1..100) { | |
sum2 += j | |
} | |
sum2 = sum2**2 |
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
primeList = [2] | |
intList = [] | |
for (int i : 3 .. 200000) { | |
if (i % 2 != 0) { | |
intList.push(i) | |
} | |
} | |
while(intList.size() != 0) { | |
primeList.push(intList.first()) | |
intList.removeAll{it % primeList.last() == 0} |
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
line = "73167176531330624919225119674426574742355349194934" + | |
"96983520312774506326239578318016984801869478851843" + | |
"85861560789112949495459501737958331952853208805511" + | |
"12540698747158523863050715693290963295227443043557" + | |
"66896648950445244523161731856403098711121722383113" + | |
"62229893423380308135336276614282806444486645238749" + | |
"30358907296290491560440772390713810515859307960866" + | |
"70172427121883998797908792274921901699720888093776" + | |
"65727333001053367881220235421809751254540594752243" + | |
"52584907711670556013604839586446706324415722155397" + |
OlderNewer