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
任意の自然数aに対し、ある自然数bが存在してa < 2^b となることを示す。 | |
このようなbが存在しないと仮定すると、任意のbに対して a ≧ 2^b | |
したがって、集合A = {2^b | b ∈ N} を考えると、この集合は上に有界であるので、上限u = sup Aが存在する。 | |
いま、u' = u / 2 とおく。 | |
uは明らかに正である(0 < 2 ∈ A)ので、u' < u | |
したがって、u' = u / 2 < 2^b' をみたすb' ∈ Aが存在する。 | |
これより 2^(b + 1) > u | |
2^(b + 1) はAの要素なので、sup Aより大きいAの要素が存在することになるが、これは矛盾。 | |
ゆえに任意の自然数aに対し、ある自然数bが存在してa < 2^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
void init() { | |
REP(i, VMAX) { | |
G[i].clear(); | |
} | |
REP(i, LMAX) { | |
ptime[i] = req[i] = 0; | |
} | |
REP(i, NMAX) { | |
REP(j, NMAX) { | |
dist[i][j] = (i == j ? 0 : INF); |
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
macro fun { | |
rule { | |
$name($param (,) ...) { | |
$body ... | |
} | |
} => { | |
macro $name { | |
rule { ($param (,) ...) } => { | |
$body ... | |
} |
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 | |
import Control.Monad | |
import System.IO | |
type Result = Either String | |
readMaybe :: (Read a) => String -> Result a | |
readMaybe st = case reads st of [(x,"")] -> Right x | |
_ -> Left ("Parse Error: \"" ++ st ++ "\"") |
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
(define nothing '()) | |
(define (just x) (list x)) | |
(define (value maybe) (car maybe)) | |
(define nothing? null?) | |
(define return just) | |
(define (>> m1 m2) | |
(>>= m1 (lambda (_) m2))) |
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
(define plus2 | |
(lambda (a . b) | |
(if (null? b) | |
(lambda (b) (+ a b)) | |
(apply (plus2 a) b)))) | |
(define (plus3 a . bc) | |
(if (null? bc) | |
(lambda (b . c) | |
(if (null? c) |
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
(define (Maybe . m) | |
`(((nothing? . ,(lambda () (null? m))) | |
(value . ,(lambda () (if (null? m) | |
(error "Nothing has no value") | |
(car m)))) | |
(show . ,(lambda () (if (null? m) | |
'Nothing | |
`(Just ,(car m)))))))) | |
(define (Just x) (Maybe x)) |
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 Control.Applicative | |
import Data.Maybe | |
data BFChar = Lt | Gt | Plus | Minus | Dot | Comma | LPar | RPar | |
deriving (Eq, Show) | |
type BFCode = [BFChar] | |
type State = ([Int], Int) | |
operateAt :: Int -> (a -> a) -> [a] -> [a] |
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
(define (1+ n) | |
(+ 1 n)) | |
(define (1- n) | |
(- n 1)) | |
(define (bfind/l pred lower upper) | |
(letrec ((M (lambda (low high) | |
(if (even? (- high low)) | |
(/ (+ high low) 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
#include<iostream> | |
#include<string> | |
using namespace std; | |
int main() { | |
string str; | |
cin >> str; | |
cout << str + "2014" << endl; | |
} |
OlderNewer