Skip to content

Instantly share code, notes, and snippets.

View sizumita's full-sized avatar
❤️
Sana Natori

sizumita sizumita

❤️
Sana Natori
View GitHub Profile
let zero = ".###" ^
".#.#" ^
".#.#" ^
".#.#" ^
".###"
let one = "..#." ^
".##." ^
"..#." ^
"..#." ^
module CountDict = Map.Make(Int)
let cnt_int lst =
let rec add_lst dict l =
match l with
| [] -> dict
| first :: rest ->
if CountDict.mem first dict then add_lst (CountDict.add first ((CountDict.find first dict) + 1) dict) rest else
add_lst (CountDict.add first 1 dict) rest
in add_lst CountDict.empty lst
let n = read_int ()
(* 文字列をcharのlistにする *)
let explode s = List.init (String.length s) (String.get s)
let dp = Array.make_matrix 100 2 0
let _ = dp.(0).(1) <- 1
let s = read_line ()
let zero = int_of_char '0'
let s_array = explode s |> List.map int_of_char |> Array.of_list
let rec zero_to_zero_loop i j k =
if j >= k then () else
(dp.(i+1).(0) <- dp.(i+1).(0) + dp.(i).(0); zero_to_zero_loop i (j+1) k)
dispander: https://github.com/DiscordBotPortalJP/dispander.git
@sizumita
sizumita / views.py
Last active November 6, 2019 13:17
Embedでリストビュー
from discord import Embed
GO_REACTION = "\N{BLACK RIGHT-POINTING TRIANGLE}"
BACK_REACTION = "\N{BLACK LEFT-POINTING TRIANGLE}"
STOP_REACTION = "\N{BLACK SQUARE FOR STOP}"
class ListView:
page = 0
embed = None
message = None
from math import ceil, floor
from web import WebView
import appex
import ui
import clipboard
import os
max_frame = (0, 0, 359, 650)
COLS = 3
ROWS = 2
# -*- coding: utf-8 -*-
from googleapiclient.discovery import build
from googleapiclient.errors import HttpError
print('youtubeの動画を検索することができます!')
print('キーワードを入れてね!')
qe = input("->")
class SearchYoutube(object):
@sizumita
sizumita / problem2.py
Last active March 18, 2017 07:43
Project Euler 2
fibs = [1,2]
index = 0
while True:
nextIndex = index + 1
fib = fibs[index]
nextFib = fibs[nextIndex]
newFib = fib + nextFib
if newFib > 4000000:
break
fibs = fibs + [newFib]
y = 0
def fibonacci(n, a=1, b=0):
return b if n < 1 else fibonacci(n - 1, a + b, a)
for x in xrange(1,35):
f = fibonacci(x, a=1, b=0)
if f % 2 == 0:
y = y + f
print y
y = 0
for x in xrange(0,1000):
if x % 3 == 0:
y = y + x
elif x % 5 == 0:
y = y + x
else:
pass
print y