Skip to content

Instantly share code, notes, and snippets.

@Joseph-Bake
Joseph-Bake / zig-zag_num.py
Last active March 8, 2020 11:07
Zig-Zag Number
#ある数より前のリストl1から選ぶよ
#ある数より後ろのリストはl2だよ
def choose_l1(l1,l2,zigzaglist):
global zigzagnum,write_flag
#前のリストがなかったら終わるよ
if l1==[]:
if l2==[]:
zigzagnum +=1
return 1
else:
@Joseph-Bake
Joseph-Bake / ZigZagNumber.py
Created March 9, 2020 12:05
Zig-Zag Number ねげろんさんのを改造
import itertools
import numpy
def getZigZagNumber(num):
# 0, 1, 2番目のZig-Zag Numberは1と定義
if (num == 0) or (num == 1) or (num == 2):
return 1
else:
alterPerm = 0
for perm in itertools.permutations(list(range(num))):
frontSign = 0
@Joseph-Bake
Joseph-Bake / m.cpp
Last active June 11, 2020 16:35
mirror
#include <iostream>
#include <cmath>
#include <vector>
#include <fstream>
#include <functional>
double fp(double phi, double a, double x, double y) {
return std::tan(0.5 * (phi + std::atan(y / (x - a))));
}