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
| import java.util.regex.Matcher; | |
| import java.util.regex.Pattern; | |
| import javax.activation.FileDataSource; | |
| import org.apache.commons.mail.MultiPartEmail; | |
| import org.apache.commons.mail.EmailAttachment; | |
| import org.apache.commons.codec.binary.Base64; | |
| public class MailC { | |
| private String mailP = "[\\w\\.\\-]+@(?:[\\w\\-]+\\.)+[\\w\\-]+"; |
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
| import java.util.Properties; | |
| import java.util.regex.Matcher; | |
| import java.util.regex.Pattern; | |
| import javax.activation.DataHandler; | |
| import javax.activation.FileDataSource; | |
| import javax.mail.Message; | |
| import javax.mail.Session; | |
| import javax.mail.Transport; | |
| import javax.mail.internet.InternetAddress; |
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%2072 | |
| //http://projecteuler.net/index.php?section=problems&id=72 | |
| //write kazua | |
| import scala.math._ | |
| import scala.collection.mutable._ | |
| object problem72 { | |
| val lmt = 1000000 |
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
| <html> | |
| <head> | |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
| <script> | |
| //write kazua | |
| var json = '{"record": [' | |
| + '{"name": "Yusuke Sasaki", "score": {"japanese" : 74, "english" : 65}},' | |
| + '{"name": "Kazuki Tajima", "score": {"japanese" : 61, "english" : 87}},' | |
| + '{"name": "Minako Ogawa", "score": {"japanese" : 45, "english" : 91}},' |
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 | |
| 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
| //http://projecteuler.net/index.php?section=problems&id=57(英語) | |
| //http://x2357.github.io/projecteuler_jatrans/problem/57.html(日本語) | |
| //2の平方根は無限に続く連分数で表すことができる. | |
| //√ 2 = 1 + 1/(2 + 1/(2 + 1/(2 + ... ))) = 1.414213... | |
| //最初の4回の繰り返しを展開すると以下が得られる. | |
| //1 + 1/2 = 3/2 = 1.5 | |
| //1 + 1/(2 + 1/2) = 7/5 = 1.4 | |
| //1 + 1/(2 + 1/(2 + 1/2)) = 17/12 = 1.41666... | |
| //1 + 1/(2 + 1/(2 + 1/(2 + 1/2))) = 41/29 = 1.41379... | |
| //次の3つの項は99/70, 239/169, 577/408である. 第8項は1393/985である. これは分子の桁数が分母の桁数を超える最初の例である. |
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%2045 | |
| //http://projecteuler.net/index.php?section=problems&id=45 | |
| //write kazua | |
| import scala.math._ | |
| object problem45 { | |
| 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 problem45(n : Int = 143 + 1, a : Long = 0) : Long = a match { |
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
| //Project Euler Problem 100 | |
| //箱の中に15個の青い円盤と6個の赤い円盤からなる21個の色のついた円盤が入っていて、無作為に2つ取り出すとき、青い円盤2つを取り出す確率P(BB)は | |
| //P(BB) = (15/21) × (14/20) = 1/2であることがわかる。 | |
| //無作為に2つ取り出すとき、青い円盤2つを取り出す確率がちょうど1/2となるような次の組み合わせは、箱が85個の青い円盤と35個の赤い円盤からなるときである。 | |
| //箱の中の円盤の合計が1,000,000,000,000を超えるような最初の組み合わせを考える。箱の中の青い円盤の数を求めよ。 | |
| //write kazua | |
| object problem100 { | |
| def problem100(limit : Long, ac : Long = 21, bc : Long = 15) : Long = ac match { |
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%2099 | |
| //指数の形で表される2つの数, 例えば 2^11 と 3^7, の大小を調べることは難しくはない. 電卓を使えば, 2^11 = 2048 < 3^7 = 2187 であることが確かめられる. | |
| //しかし, 632382^518061 > 519432^525806 を確認することは非常に難しい (両者ともに300万桁以上になる). | |
| //各行に1組が書かれている1000個の組を含んだ22Kのテキストファイルbase_exp.txtから, 最大の数が書かれている行の番号を求めよ. | |
| //write kazua | |
| import scala.io.Source | |
| import scala.math._ |