Skip to content

Instantly share code, notes, and snippets.

View LuckyKoala's full-sized avatar
🎯
Focusing

LuckyKoala

🎯
Focusing
View GitHub Profile
@LuckyKoala
LuckyKoala / 6174.c
Last active June 18, 2018 14:24
6174是黑洞数(亦称为卡布列克常数,任何非四位相同数字,只要将数字重新排列,组合成最大的值和最小的数再加以相减,重复以上步骤,七次以内就会出现6174。例如:8045,8540-0458=8082,8820-0288=8532,8532-2358=6174。)
#include <stdio.h>
#include <stdlib.h>
#include "mpi.h"
//------Common base------
typedef int bool;
enum { false, true };
//------Define a struct of four digit number------
typedef struct {
int thousand;
@LuckyKoala
LuckyKoala / evaluator.scm
Last active November 2, 2018 12:49
SICP 4.1,Lisp解释器实现(包含习题解答)
(define (eval exp env) ((analyze exp) env))
(define (analyze exp)
(cond ((self-evaluating? exp)
(analyze-self-evaluating exp))
((quoted? exp)
(analyze-quoted exp))
((variable? exp)
(analyze-variable exp))
((assignment? exp)