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 | |
| for ($i = 1; $i <= 100; $i++) { | |
| $a1 += pow($i, 2); | |
| $a2 += $i; | |
| } | |
| $result = pow($a2, 2) - $a1; | |
| echo $result; |
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=77(英語) | |
| //http://odz.sakura.ne.jp/projecteuler/index.php?cmd=read&page=Problem%2077 | |
| //Kazua | |
| import scala.collection.mutable._ | |
| import scala.math._ | |
| object problem77 { | |
| lazy val pr : Stream[Int] = 2 #:: Stream.from(3).filter(i => pr.takeWhile(j => pow(j, 2) <= i).forall(i % _ > 0)).takeWhile(_ < 5000) |
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 | |
| $num1 = 1; | |
| $num2 = 1; | |
| $result = 0; | |
| $i = 0; | |
| while ($i < 4000000) { | |
| if ($i % 2 === 0) $result += $i; | |
| $i = $num1 + $num2; | |
| $num2 = $num1; |
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 | |
| $result = 0; | |
| $result = array_sum(array_filter(range(1, 999), | |
| function ($value) { | |
| return (($value % 3 == 0) || ($value % 5 == 0)); | |
| })); | |
| echo $result; |
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=76(英語) | |
| //http://odz.sakura.ne.jp/projecteuler/index.php?cmd=read&page=Problem%2076 | |
| //Kazua | |
| import scala.collection.mutable._ | |
| object problem76 { | |
| def problem76(n : Int = 100, p : Seq[Long] = 1L +: Seq.fill(100)(0L), i : Int = 1, j : Int = 1) : Long = i match { | |
| case i if i <= 99 => { |
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 | |
| header("Content-Type:text/html;charset=UTF-8"); | |
| if (isset($_POST['body'])) { | |
| ?> | |
| <html> | |
| <head> | |
| <title>メール送信結果</title> | |
| </head> | |
| <body> | |
| <?php |
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 org.apache.poi.hssf.usermodel.HSSFWorkbook | |
| import org.apache.poi.openxml4j.exceptions.InvalidFormatException | |
| import org.apache.poi.ss.usermodel.Cell | |
| import org.apache.poi.ss.usermodel.CellStyle | |
| import org.apache.poi.ss.usermodel.DataFormat | |
| import org.apache.poi.ss.usermodel.Sheet | |
| import org.apache.poi.ss.usermodel.Workbook | |
| import org.apache.poi.ss.usermodel.WorkbookFactory |
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=89(英語) | |
| //http://odz.sakura.ne.jp/projecteuler/index.php?cmd=read&page=Problem%2089 | |
| //Kazua | |
| import scala.io.Source | |
| object problem89 { | |
| val p = "VIIII|LXXXX|DCCCC|IIII|XXXX|CCCC".r | |
| def problem89(ls : List[String]) = ls.mkString.length - ls.map(p.replaceAllIn(_, "--")).mkString.length |
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=69(英語) | |
| //http://odz.sakura.ne.jp/projecteuler/index.php?cmd=read&page=Problem%2069 | |
| //Kazua | |
| import scala.math._ | |
| object problem69 { | |
| lazy val pr : Stream[Int] = 2 #:: Stream.from(3).filter(i => pr.takeWhile(j => pow(j, 2) <= i).forall(i % _ > 0)) | |
| def problem69(n : Int = 1, i : Int = 0, p : Stream[Int] = pr, m : Int = 1000000) : Int = n 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://projecteuler.net/index.php?section=problems&id=58(英語) | |
| //http://odz.sakura.ne.jp/projecteuler/index.php?cmd=read&page=Problem%2058 | |
| //Kazua | |
| import scala.collection.mutable._ | |
| object problem58 { | |
| val m = Map[Int, Boolean]() | |
| def isPrime(n : Int) = |