Skip to content

Instantly share code, notes, and snippets.

View niyarin's full-sized avatar
💣

Akira Inoue niyarin

💣
View GitHub Profile
@niyarin
niyarin / gen-graph.scm
Last active February 4, 2017 11:57
雑に重み付き有向グラフを生成するやつ
;雑にグラフを生成する
(import (scheme base)(scheme write)(srfi 1)(srfi 27))
(random-source-randomize! default-random-source)
;乱数のリストを生成する
(define (generate-random-integer-list len max-number)
(let loop ((i len))
(define decorate #f)
(let ((pos-seed 1)
(shape-seed 1))
(set! decorate
(lambda (leaves)
(for-each
(lambda (_)
(set! pos-seed (modulo (+ (* pos-seed 3) 7) 26))
(set! shape-seed (modulo (+ shape-seed 1) 3))
(if (< pos-seed (string-length leaves))
(define (caar x) (car (car x )))
(define (cadr x) (car (cdr x )))
(define (cdar x) (cdr (car x )))
(define (cddr x) (cdr (cdr x )))
(define (caaar x) (car (caar x)))
(define (cdaar x) (cdr (caar x)))
(define (caadr x) (car (cadr x)))
(define (cdadr x) (cdr (cadr x)))
(define (cadar x) (car (cdar x)))
(define (cddar x) (cdr (cdar x)))
@niyarin
niyarin / aoj_1188.cpp
Last active August 29, 2015 14:03
aoj_1188
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
int main(void){
int nest,len;
string S;
@niyarin
niyarin / aoj_1174.py
Last active August 29, 2015 14:03
aoj_1174.py
def Search_friend(fr,pos,cl):
if pos[0] > W - 1 or pos[1] > H - 1 or pos[0] < 0 or pos[1] < 0:
return []
if note[pos[0]][pos[1]] == id:
return []
temp = []
if pos in fr :
while True:
to_dic = {}
path_dic = {}
N = input()
if N==0:
break
n = input()
cow_list = []
def eated_flower(list,time,cnt=0):
num = 0
for l in list:
num += l[1 + cnt] * time
return num
c2 = []
n = input()
note = [[-1 for i in range(n)] for j in range(n)]
data = []
for i in range(n):
data.append(raw_input().split(" "))
print data
def Foo(x,y):
@niyarin
niyarin / 2385.py
Last active August 29, 2015 14:02
t,w = raw_input().split(" ")
T,W = int(t),int(w)
apple_data = []
for i in range(int(T)):
apple_data.append(input()-1)
note= [[-1 for j in range(T) ] for i in range(W + 1)]