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
--http://projecteuler.net/problem=1 | |
--If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. | |
--Find the sum of all the multiples of 3 or 5 below 1000. | |
main = do | |
print $ sum [ x | x<-init[1..1000], x`mod`==0 || x`mod`5==0 ] |
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 Data.List (foldl') | |
isPalindrome :: Integer -> Bool | |
isPalindrome x = show x == reverse (show x) | |
main = do | |
print $ foldl' max 0 [ a*b | a<-[100..999], b<-[100..999], isPalindrome (a*b) ] |
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 Data.Char | |
import System.IO | |
import System.Environment | |
main = do | |
(command:argList) <- getArgs | |
dispatch command argList | |
dispatch :: String -> [String] -> IO () | |
dispatch "add" = calc (+) |
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 Data.Char | |
main = do | |
l <- getLine | |
let nums = map digitToInt l | |
putStrLn $ show $ maxNum nums | |
maxNum :: [Int] -> Int | |
maxNum [] = 0 | |
maxNum all@(x:xs) = max (product (take 5 all)) (maxNum xs) |
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
(* parameters *) | |
(* 最大次数 *) | |
maxOrderNum = 200; | |
(* 画像URL, もしくはローカルパス *) | |
imageURL = "http://nex.fm/wp-content/uploads/2012/08/vim-editor_logo.png"; | |
pointListToLines[pointList_, neighbothoodSize_: 6] := | |
Module[{L = DeleteDuplicates[pointList], NF, lambda, | |
lineBag, counter, seenQ, sLB, nearest, | |
nearest1, nextPoint, couldReverseQ, d, n, s}, |
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
""""""""""""""""""""" | |
" general | |
""""""""""""""""""""" | |
set number | |
set tabstop=2 | |
set laststatus=2 | |
set t_Co=256 | |
set expandtab | |
set noswapfile |
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
switch(i%4): | |
case 0: | |
thinca | |
case 1: | |
kyubuns | |
case 2: | |
supermomonga | |
case 3: | |
aomoriringo |
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
>>> from uzumaki import * | |
>>> [uzumaki(x) for x in range(20)] | |
[(0, 0), (1, 0), (1, 1), (0, 1), (-1, 1), (-1, 0), (-1, -1), (0, -1), (1, -1), (2, -1), (2, 0), (2, 1), (2, 2), (1, 2), (0, 2), (-1, 2), (-2, 2), (-2, 1), (-2, 0), (-2, -1)] | |
>>> uzumaki(1000000000) | |
(1683, -15811) |
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
x27[32;01m * x27[39;49;00mPackage: dev-lang/R-3.1.2 | |
x27[32;01m * x27[39;49;00mRepository: gentoo | |
x27[32;01m * x27[39;49;00mMaintainer: calchan@gentoo.org sci-mathematics@gentoo.org | |
x27[32;01m * x27[39;49;00mUSE: abi_x86_64 amd64 elibc_glibc kernel_linux nls openmp readline userland_GNU | |
x27[32;01m * x27[39;49;00mFEATURES: preserve-libs sandbox userpriv usersandbox | |
x27[32;01m*x27[0m Using following Fortran compiler: | |
x27[32;01m*x27[0m F77: x86_64-pc-linux-gnu-gfortran | |
x27[32;01m*x27[0m FC: x86_64-pc-linux-gnu-gfortran | |
x27[32;01m*x27[0m x86_64-pc-linux-gnu-gfortran has OPENMP support | |
>>> Unpacking source... |
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
let s:name = 'World' | |
echo "\nHello" . s:name | |
function! Isdigit(str) | |
return match(a:str, '^[+-]\?\d\+$') != -1 | |
endfunction | |
let g:bigint = {'num': [], 'sign': 1} | |
let g:nodeMaxDigit = 8 |
OlderNewer