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 asyncio | |
import binascii | |
from bleak import BleakClient, BleakScanner | |
COMMUNICATION_SERVICE_UUID = "cba20d00-224d-11e6-9fb8-0002a5d5c51b" | |
RX_CHARACTERISTIC_UUID = "cba20002-224d-11e6-9fb8-0002a5d5c51b" | |
TX_CHARACTERISTIC_UUID = "cba20003-224d-11e6-9fb8-0002a5d5c51b" | |
PRESS = "PRESS" | |
ON = "ON" |
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
Optimal - objective value 13.00000000 | |
4 X0000004 8 0 | |
11 X0000011 6 0 | |
23 X0000023 7 0 | |
32 X0000032 10 0 | |
40 X0000040 11 0 | |
56 X0000056 13 0 | |
68 X0000068 6 0 | |
74 X0000074 2 0 | |
75 X0000075 11 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
from pulp import * | |
def solve(initial_solution_file_path: str=None): | |
left = list(range(10)) | |
right = list(range(10)) | |
route = [(i, j) for i in left for j in right] | |
supply = [8, 6, 7, 10, 11, 13, 6, 13, 14, 12] | |
demand = [11, 11, 10, 7, 10, 11, 13, 9, 9, 9] |
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
from pulp import * | |
def solve(): | |
left = list(range(10)) | |
right = list(range(10)) | |
route = [(i, j) for i in left for j in right] | |
supply = [8, 6, 7, 10, 11, 13, 6, 13, 14, 12] | |
demand = [11, 11, 10, 7, 10, 11, 13, 9, 9, 9] |
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 numpy as np | |
from math import exp, log | |
def sigmoid(x): | |
return 1 / (1 + exp(-x)) | |
class FactorizationMachines: | |
def __init__(self, epoch: int=1000, k: int=3, eta: float=0.01, seed: int=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 <bits/stdc++.h> | |
#define FOR(i,a,b) for(int i= (a); i<((int)b); ++i) | |
#define FOE(i,a) for(auto i : a) | |
#define ALL(c) (c).begin(), (c).end() | |
#define LL long long | |
#define LOG(c) logger.log(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
import random | |
import time | |
def construct(n): | |
pi = list(range(n)) | |
random.shuffle(pi) | |
return pi | |
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
def burrows_wheeler_transform(s: str) -> str: | |
assert s.count("$") == 1 | |
n = len(s) | |
table = [[None] * n for _ in range(n)] | |
for i in range(n): | |
for j in range(n): | |
table[i][j] = s[(i + j) % n] | |
table.sort() |
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 json | |
import urllib.request | |
def main(): | |
jsonp = urllib.request.urlopen("http://www.drk7.jp/weather/json/13.js").read().decode("utf-8") | |
data = json.loads(jsonp.replace("drk7jpweather.callback(", "")[:-2]) | |
for j in data["pref"]["area"]["東京地方"]["info"]: | |
date = j["date"] | |
rainfall_chance = j["rainfallchance"] |
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 <vector> | |
#include <string> | |
#include <set> | |
#include <algorithm> | |
#include <map> | |
#include <vector> | |
#include <string> | |
#include <set> | |
#include <algorithm> |
NewerOlder