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 math | |
n = int(input()) | |
n2 = n * 2 | |
max = math.floor(math.sqrt(n2)) | |
arr = [] | |
for i in range(2, max + 1): | |
if n2 % i == 0: | |
j = n2 // i | |
if i % 2 == 0 and j % 2 == 1: |
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
#!/usr/bin/env python | |
# coding:utf-8 | |
import re | |
import datetime | |
class Ticket: | |
def __init__(self, name, start, end): | |
self.name = name | |
self.start = start |
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
# 方針(詳しく説明するのは大変なので、概略だけ) | |
# | |
# ちょうどN回反転して出るルートの総数を足し合わせれば良い。 | |
# Nが偶数の時は0なので、奇数の時を考える。 | |
# | |
# N = 2M - 1回反転するときのルートの総数は、 | |
# Mを正の整数に順列分割(?)する総数に対応づけることができる。(方法は省略) | |
# 具体的には、問題は次のもの。 | |
# | |
# 問題 |
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
# -*- coding: utf-8 -*- | |
# for Python 3 | |
# リールの数 | |
num_reel = 3 | |
# 自然数を正整数の和に分割 和の順序は考えない | |
# 返り値はリストのリスト | |
# 各要素リストlsに対し、ls[i]が数字iの個数を表す | |
# 例えば 4 = 1 + 1 + 2 なら [0, 2, 1] |
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 <stdio.h> | |
/* maxは、どの文字がいくつあるかという配列 | |
その文字で出来る語の総数を求める関数 */ | |
long int gem_total(int max[], int n_max){ | |
int i, check = 0; | |
long int total; | |
for(i=0; i<n_max; i++){ | |
if(max[i] != 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
<?xml version="1.0"?> | |
<root> | |
<inputsourcedef> | |
<name>JA_IME</name> | |
<inputmodeid_equal>com.apple.inputmethod.Japanese</inputmodeid_equal> | |
</inputsourcedef> | |
<appdef> | |
<appname>iTERM2</appname> | |
<equal>com.googlecode.iterm2</equal> | |
</appdef> |
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
︠ef71f22d-2e92-4007-b961-4e8fd2cc5023s︠ | |
class MyRSCode: | |
def __init__(self, n, k, F, a, Fx, x): | |
self.n = n | |
self.k = k | |
self.field = F | |
self.field_generator = a | |
self.polynomial_ring = Fx | |
self.x = x | |
self.gen_poly = generate_gen_poly(self.n - k + 1, F, a, Fx, x) |
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 sys | |
import os | |
import datetime | |
import subprocess | |
from keyhac import * | |
def configure(keymap): |
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
# 全ての点を通るので、 | |
# w, hに対して、距離は (w + 1)(h + 1) - 1 = wh + w + h になる | |
# 片方を固定して数え上げ | |
import math | |
n = int(input()) | |
s = 0 | |
i = 1 |
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
(* 累乗関数 *) | |
(* 数でも行列でも使える *) | |
let rec pow a n op un = (* opが演算子、unがunit *) | |
if n == 0 then un | |
else | |
let b = pow a (n/2) op un in | |
if n mod 2 == 0 then op b b | |
else op b (op b a);; | |
let m = pow 10 6 ( * ) 1;; | |
(* mod mでの計算の演算子 *) |
OlderNewer