def readstdin(self): time.sleep(1) while self.running: if self.use_stdio: line = sys.readline() else: try: line = raw_input() except (EOFError): self.running = False self.gui.setreadstate(False) break if self.running: self.queue.put(line)
import sys sub = sys.readline().strip().upper() sub2 = sys.readline().strip().upper() matrix = [ (len(sub2)+1)*[0] for _ in range(len(sub)+1) ] for i in range(1, len1+1): for j in range(1, len2+1): if sub[i-1] == sub2[j-1]: matrix[i][j] = matrix[i-1][j-1]+1 else : matrix[i][j] = max(matrix[i-1][j], matrix[i][j-1]) print(matrix[-1][-1])
(opts, args) = p.parse_args() if ((opts.token and len(args) != 1) or len(args) != 2): print "Usage: cblr_cli [OPTS] [URL] [API_TOKEN]" print "" print "Options:" print " -v, --verbose : Display HTTP transactions" print " -l, --log [FILE]: Log HTTP transactions to a file " print " -t, --token : Prompt for the API token" sys.exit(-1) url = args[0] if (opts.token): print "Enter API Token:" token = sys.readline().strip() else: token = args[1] print "Connecting to %s" % url while (1): try: cli = CblrCli(url, token, verbose=opts.verbose, httpLog=opts.log); cli.prompt = ">" cli.cmdloop() except Exception as e: import traceback print "Error: An unknown exception occured:" print ""
import sys def mat(a, b, n): ret = [[0] * n for i in range(n)] for i in range(n): for j in range(n): for k in range(n): ret[i][j] = (ret[i][j] + a[i][k] * b[k][j]) % 1000000007 return ret def fib(n): l = [[1, 1], [1, 0]] ans = [[1, 0], [0, 1]] while (n): if n % 2: ans = mat(ans, l, 2) l = mat(l, l, 2) n //= 2 return ans[1][0] t = int(sys.stdin.readline()) for i in range(t): n, m = map(int, sys.readline().split()) while n: n, m = m % n, n print(fib(m) % 1000000007)
def main(): "Main program." import sys data = sys.readline().strip()
import sys while 1: sys.readline() print('*')
import sys n = int(sys.readline().rstrip()) n_arr = list(map(int,sys.readline().rstrip().split())) m = int(sys.readline().rstrip()) m_arr = list(map(int,sys.readline().rstrip().split())) m_arr.sort() for item in m_arr: half = arr[n-1]//2 while start>= end: if half == item: return print("yes") elif half < item: pass elif: pass
(opts, args) = p.parse_args() if ((opts.token and len(args) != 1) or len(args) != 2): print "Usage: cblr_cli [OPTS] [URL] [API_TOKEN]" print "" print "Options:" print " -v, --verbose : Display HTTP transactions" print " -l, --log [FILE]: Log HTTP transactions to a file " print " -t, --token : Prompt for the API token" sys.exit(-1) url = args[0] if (opts.token): print "Enter API Token:" token = sys.readline().strip() else: token = args[1] print "Connecting to %s" % url while (1): try: cli = CblrCli(url, token, verbose=opts.verbose, httpLog=opts.log) cli.prompt = ">" cli.cmdloop() except Exception as e: import traceback print "Error: An unknown exception occured:" print ""
import sys r = int(sys.readline()) # r은 체크 포인트 갯수 for _ in range(r): x, y, s = int(sys.readline()) # 좌표 x, y와 점수 s name_dict = dict() while True: