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 -*- | |
# お題: 時間帯重複チェック | |
def checkIfSyntax(time1, time2): | |
""" | |
>>> checkIfSyntax((-2,3,1,1,), (1,1,1,1)) | |
Traceback (most recent call last): | |
... |
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 math | |
N = 10000 | |
def main(): | |
numList = range(1, N + 1) | |
# 1を除く | |
numList.pop(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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# お題: 時間帯重複チェック(応用編) | |
def CheckIfSyntax(*timeTuple): | |
for i in xrange(len(timeTuple)): | |
(timeStartHour, timeStartMin, timeEndHour, timeEndMin) = timeTuple[i] | |
# 時間の書式のチェック | |
if timeStartHour > 24 or timeEndHour > 24 \ |
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 urllib2 | |
import json | |
API_KEY = "" | |
class GoogleURLShorter(object): | |
def __init__(self, target_url, api_key=""): | |
self.baseUrl = 'https://www.googleapis.com/urlshortener/v1/url' |
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 -*- | |
# ファイルとサブディレクトリのパスを表示 | |
MUSIC_PATH = u"/Users/USERNAME/Music/iTunes/iTunes Media/Music" | |
import glob | |
import os | |
from unicodedata import normalize | |
from subprocess import call |
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 -*- | |
# □□□□ × □ = □□□□ | |
# として、□の中に1~9の数字が一つずつ入る時の組合せ | |
# 1000~9999 * 1~9 を総当りで確かめてみるか → パソコンの力任せ | |
# (a, b, c) で組合せを表現 | |
# 3値のタプルを入力とし、使われている数字をリストで返す |
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 -*- | |
def _test(): | |
import doctest | |
doctest.testmod() | |
def cut(cardList, fromA, toB): | |
""" | |
>>> a = [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 -*- | |
from problemC import process as correct | |
def file_open(filename): | |
T = 0 | |
caseList = [] | |
with open(filename) as f: | |
T = int(f.readline().strip()) |
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 -*- | |
def file_open(filename): | |
T = 0 | |
caseList = [] | |
with open(filename) as f: | |
T = int(f.readline().strip()) | |
for i in range(T): | |
value = [int(x) for x in f.readline().strip().split()] |
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 -*- | |
def file_open(filename): | |
T = 0 | |
caseList = [] | |
with open(filename) as f: | |
T = int(f.readline().strip()) | |
for i in range(T): | |
key = int(f.readline().strip()) |
OlderNewer