Instantly share code, notes, and snippets.

# takuma7 takuma7

Created August 20, 2010 05:32
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
 #include int main(void){ printf("Hello World!\n"); //this is a test }
Created October 22, 2010 13:18
Project Euler - Problem 1
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
 import System.IO main = do putStrLn $show$ sum $filter judge [1..999] judge a | a mod 3 == 0 || a mod 5 == 0 = True | otherwise = False Created October 22, 2010 13:24 Project Euler - Problem 2 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  import System.IO main = do putStrLn$ show $sum$ filter even $takeWhile ((>) 4000000) fib fib = 1:2:[ a+b | (a,b) <- zip fib (tail fib)] Created October 23, 2010 02:07 Project Euler - Problem 3 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  import System.IO main = do putStrLn$ show $last$ filter ((== 0) . (mod 600851475143)) (takeWhile (< (truncate (sqrt 600851475143))) prime) prime = 2:f [3] [3,5..] where f (x:xs) ys = let (ps, qs) = span (< x^2) ys in ps ++ f (xs ++ ps) [z | z <- qs, z mod x /= 0]
Created October 23, 2010 02:08
Project Euler - Problem 4
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
 import System.IO main = do putStrLn $biggest "0" [ show (a*b) | a <- [100..999], b <- [100..999], isPalindromicNum (show (a*b))] isPalindromicNum [] = True isPalindromicNum (_:[]) = True isPalindromicNum (x:xs) | x == last xs = isPalindromicNum (init xs) | otherwise = False Created October 23, 2010 08:55 Project Euler - Problem 5 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  import System.IO main = do putStrLn$ show $foldr lcm 1 [1..20] Created November 18, 2010 15:50 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(){scroll(0,0);H='http://images.uncyc.org/ja/f/fb/';D=document;D.body.appendChild(B=D.createElement('b'));with(B.style){position='absolute';color='#0F0';fontSize='192px';top=0};S=0;F=Math.floor;R=Math.random;Q=new Image;Q.src=H+'Shiled_bugs.png';L=function(){var X=F(R()*vw);var Y=0;var r=F(R()*9)+3;var V=Z(X,Y);D.body.appendChild(V);var f=function(){if(Y+r Created January 13, 2011 06:03 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  line = STDIN.gets("\n\n") tabular = line.split("\n") #puts tabular columnNum = tabular[0].split("\t").length #puts columnNum puts "\n\nResult:" puts "\\begin{table}[htbp]\n\t\\caption{***}\n\t\\begin{center}\n\t\\begin{tabular}{#{"|"+"c|"*columnNum}}\\hline" tabular.each do |row| Created January 30, 2011 05:19 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  ¥begin{table}[htbp] ¥caption{$V_{DS} - I_D$特性} ¥begin{center} ¥begin{tabular}{|c|c|c||c|c|c|}¥hline$V_{GS}[V]$&$V_{DS}$[V] &$I_{D}$[mA] &$V_{GS}$[V] &$V_{DS}$[V] &$I_{D}$[mA] ¥¥ ¥hline¥hline -0.2 & 0 & 0.307 & -1 & 0 & 1.02 ¥¥ ¥cline{2-3} ¥cline{5-6} & 1 & 1.84 & & 1 & 1.1 ¥¥ ¥cline{2-3} ¥cline{5-6} & 2 & 2.81 & & 2 & 1.12 ¥¥ ¥cline{2-3} ¥cline{5-6} & 3 & 3 & & 3 & 1.12 ¥¥ ¥cline{2-3} ¥cline{5-6} & 4 & 3.05 & & 4 & 1.12 ¥¥ ¥cline{2-3} ¥cline{5-6} Created April 24, 2011 01:53 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  #!/usr/bin/perl use CGI; use HTML::Entities;$form = CGI->new(); $handle =$form->param("handle"); $speech =$form->param("speech"); print "Content-type: text/html; charset=UTF-8\n\n";