Skip to content

Instantly share code, notes, and snippets.

Masahiro Suzuki retarfi

  • Tokyo
View GitHub Profile
@retarfi
retarfi / 1to9calc.py
Last active Feb 19, 2018
1,2,3,4,5,6,7,8,9の間に+,-,xのうちどれかを入れて結果が1となるようなものを抽出
View 1to9calc.py
for i in range(6561): #6561=3^8
numli = [1,2,3,4,5,6,7,8,9] #計算式に出てくる数字
calcli = [] #+を0,-を1,xを2として3進法8桁で演算子を表す
while i != 0:
calcli.append(int(i%3))
i = int(i/3)
if(len(calcli)<8): #8桁に足りない部分は全部0にする
for j in range(8-len(calcli)):
calcli.append(0)
calcli.reverse() #全通り試すのでなくてもいい
@retarfi
retarfi / 02.py
Last active Oct 23, 2017
言語処理100本ノック 02
View 02.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
s = "".join(i+j for i, j in zip('パトカー', 'タクシー'))
print(s)
@retarfi
retarfi / 01.py
Last active Oct 23, 2017
言語処理100本ノック 01
View 01.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
letters = "パタトクカシーー"
print(letters[::2])
@retarfi
retarfi / 00.py
Last active Oct 23, 2017
言語処理100本ノック 00
View 00.py
#!/usr/bin/env python3
letters = "stressed"
print(letters[::-1])
You can’t perform that action at this time.