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
object fibonacci { | |
def main(args: Array[String]) { | |
var fibonacci = List(1,1) | |
while(fibonacci.length < args(0).toInt) { | |
fibonacci = fibonacci :+ fibonacci.takeRight(2).sum | |
} | |
println(fibonacci.apply(args(0).toInt - 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
(ns grimoire.jcurses | |
(:import (jcurses.system CharColor) | |
(jcurses.widgets DefaulLayoutManager) | |
(jcurses.widgets WidgetsConstants) | |
(jcurses.widgets Window))) | |
(def lbl | |
(doto | |
(Label. | |
"All gone to hell!" |
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
(defn fizzbuzz | |
"fizzbuzz" | |
[x] | |
(cond (and (= (mod x 3) 0) | |
(= (mod x 5) 0)) "Fizz Buzz" | |
(= (mod x 3) 0) "Fizz" | |
(= (mod x 5) 0) "Buzz" | |
:else 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
#include <stdio.h> | |
int sum(const int num[],const int count,const int result){ | |
if (count == 0) { | |
return result + num[count]; | |
} else { | |
sum(num,(count-1),(result + num[count])); | |
} | |
} |
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
// 文字列版take | |
void take_char(int n, char* string, char* substring) { | |
int i; | |
for (i = 0; i < n; i++) { | |
substring[i] = string[i]; | |
} | |
substring[i+1] = '\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
#include <stdio.h> | |
int main(int argc, char const* argv[]) | |
{ | |
const int a = 500,b = 300,c = 0; | |
int as,bs,cs; | |
printf("PC|゚Д゚)ノ イラッシャイ\n"); | |
printf("[おしながき]\nクソネミ( ˘ω˘ ):%d円\nエクストリームドドスコンダーオ:%d円\nスマイル( ◠‿◠ ):%d円\n", a, b, c); | |
printf("いくつ買う? -> クソネミ( ˘ω˘ ):"); | |
scanf("%d", &as); |
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
(reduce + | |
(filter | |
(fn [x] | |
(or (= 0 (rem x 5)) | |
(= (rem x 3)))) | |
(range 1 1001))) |
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
(println | |
(reduce + | |
(loop [result [1 2]] | |
(if (> (last result) 4000000) | |
(filter even? (drop-last result)) | |
(recur (conj result (reduce + (take-last 2 result)))))))) |
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
(defn palindromic? [number] | |
(loop [numseq (seq (str number))] | |
(cond (<= (count numseq) 1) true | |
(= (first numseq) (last numseq)) (recur (drop-last (rest numseq))) | |
:else false))) | |
(def thdigits | |
(range 100 1000)) | |
(println (last (sort (filter palindromic? (for [x thdigits y thdigits] (* x y)))))) |
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
(defn coll-divides? [x coll] | |
(every? true? (filter #(not= (mod x %) 0) coll))) | |
(loop [x 20] | |
(if (coll-divides? x (range 1 21)) | |
x | |
(recur (+ x 10))))) |
OlderNewer