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
| <?php | |
| //write kazua | |
| header("Content-Type:text/html;charset=UTF-8"); | |
| require_once('../lib/twitteroauth.php'); | |
| $ck = '***********';//キーは自分で取得したものを設定 | |
| $cs = '***********';//キーは自分で取得したものを設定 | |
| $at = '***********';//キーは自分で取得したものを設定 | |
| $as = '***********';//キーは自分で取得したものを設定 | |
| $tw = new TwitterOAuth($ck,$cs,$at,$as); |
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
| //write kazua | |
| if (!Array.prototype.contains) { | |
| Array.prototype.contains = function(value) { | |
| for ( var i = 0; i < this.length; i++) | |
| if (this[i] === value) | |
| return true; | |
| return false; | |
| }; | |
| } |
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
| //write kazua | |
| import twitter4j._ | |
| import twitter4j.conf._ | |
| import scala.collection.JavaConverters._ | |
| import java.awt.Desktop | |
| import java.net._ | |
| import javax.swing.JOptionPane | |
| import java.io._ |
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
| //http://odz.sakura.ne.jp/projecteuler/index.php?cmd=read&page=Problem%2071 | |
| //write kazua | |
| object problem71 { | |
| def problem71(mn : Int) = { | |
| problem71Proc(mn)._1 | |
| } | |
| def problem71Proc(mn : Int, kn : (Int, Int) = (3, 7), cn : (Int, Int) = (2, 5)) : (Int, Int) = (cn._2 + kn._2) match { | |
| case sn if sn > mn => cn | |
| case sn => problem71Proc(mn, kn, (cn._1 + kn._1, sn)) |
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
| //http://odz.sakura.ne.jp/projecteuler/index.php?cmd=read&page=Problem%2042 | |
| //write kazua | |
| import scala.io.Source | |
| import scala.math._ | |
| object problem42 { | |
| def isTriNum(n : Double) = (sqrt(8 * n + 1.0) - 1.0) / 2.0 == ((sqrt(8 * n + 1.0) - 1.0) / 2.0).toInt | |
| def alpindex(c : Char) = "abcdefghijklmnopqrstuvwxyz".indexOf(c.toLower) + 1 | |
| def problem42(fp : String) = { |
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
| //write kazua | |
| import twitter4j._ | |
| import twitter4j.conf._ | |
| import scala.collection.JavaConverters._ | |
| object twitter { | |
| def twitterinfo(sw : String) = { | |
| //認証 | |
| val cb = new ConfigurationBuilder |
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
| //http://odz.sakura.ne.jp/projecteuler/index.php?cmd=read&page=Problem%2044 | |
| //write kazua | |
| import scala.math._ | |
| object problem44 { | |
| def isPenNum(d : Double) = (sqrt(1.0 + 24.0 * d) + 1.0) / 6.0 == ((sqrt(1.0 + 24.0 * d) + 1.0) / 6.0).toInt | |
| def problem44(fn : Int, sn : Int, an : Int) : Int = an match { | |
| case a if a > 0 => a | |
| case _ => { |
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
| //http://odz.sakura.ne.jp/projecteuler/index.php?cmd=read&page=Problem%2031 | |
| //write kazua | |
| object problem31 { | |
| val coinlist = List(1, 2, 5, 10, 20, 50, 100, 200) | |
| def getCoinComb(cl : List[Int], ta : Int, ac : Int) : Int = cl match { | |
| case h :: t if h + ac > ta => 0 | |
| case h :: t if h + ac == ta => 1 | |
| case h :: t => getCoinComb(cl, ta, ac + h) + getCoinComb(t, ta, ac) | |
| case nil => 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
| //write kazua | |
| if (!Array.prototype.randompop) { | |
| Array.prototype.randompop = function() { | |
| "use strict"; | |
| if (this == null) | |
| throw new TypeError(); | |
| var t = Object(this), len = t.length >>> 0; | |
| if (len == 0) | |
| return null; |
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
| //write Kazua | |
| import scala.collection.mutable._ | |
| object worldproblem9_1 { | |
| def CntUpStairs(sc : Int) = { | |
| sc + "段の階段の上り方は" + CntUpStairsProc(sc) + "通りあります。" | |
| } | |
| def CntUpStairsProc(sc : Int, ss : Map[Int, Int] = Map.empty) : Int = sc match { | |
| case c if c < 0 => 0 |