摘要: 1 import stdarray 2 import math 3 import stddraw 4 import stdaudio 5 import stdio 6 SPS = 44100 7 CONCERT_A = 440.0 8 while not stdio.isEmpty(): 9 pitch = stdio.readInt() 10 duration... 阅读全文
posted @ 2017-08-04 00:00 跳过了E 阅读(171) 评论(0) 推荐(0) 编辑
摘要: 1 import stddraw 2 3 stddraw.setXscale(-1, 1) 4 stddraw.setYscale(-1, 1) 5 6 DT = 20.0 7 RADIUS = 0.05 8 rx = 0.480 9 ry = 0.860 10 vx = 0.015 11 vy = 0.023 12 while True: 13 #Update b... 阅读全文
posted @ 2017-08-03 23:25 跳过了E 阅读(315) 评论(0) 推荐(0) 编辑
摘要: 1 import stddraw 2 import stdio 3 # Read and set the x- and y- scales 4 x0 = stdio.readFloat() 5 y0 = stdio.readFloat() 6 x1 = stdio.readFloat() 7 y1 = stdio.readFloat() 8 stddraw.setXscale(x... 阅读全文
posted @ 2017-08-03 13:50 跳过了E 阅读(288) 评论(0) 推荐(0) 编辑
摘要: 1 import random 2 import sys 3 import stdio 4 import stdarray 5 n = int(sys.argv[1]) 6 trials = int(sys.argv[2]) 7 deadEnds = 0 8 9 for t in range(trials): 10 a = stdarray.create2D(n, n... 阅读全文
posted @ 2017-08-02 14:01 跳过了E 阅读(1168) 评论(0) 推荐(0) 编辑
摘要: 1 import sys 2 import stdarray 3 import stdio 4 n = int(sys.argv[1]); 5 isPrime = stdarray.create1D(n+1, True); 6 for i in range(2,n+1): 7 if isPrime[i]: 8 #Mark multiples of i as... 阅读全文
posted @ 2017-08-02 13:12 跳过了E 阅读(353) 评论(0) 推荐(0) 编辑
摘要: 1 import random 2 import sys 3 import stdarray 4 import stdio 5 6 n = int(sys.argv[1]) 7 count = 0 8 collectedCount = 0 9 isCollected = stdarray.create1D(n, False) 10 while collectedCount <... 阅读全文
posted @ 2017-07-31 16:27 跳过了E 阅读(208) 评论(0) 推荐(0) 编辑
摘要: import sys import random import stdarray import stdio m = int(sys.argv[1]) n = int(sys.argv[2]) # Initialize array perm = [0,1,...,n-1] perm = stdarray.create1D(n, 0) for i in range(n): perm[i]... 阅读全文
posted @ 2017-07-31 15:03 跳过了E 阅读(1594) 评论(0) 推荐(0) 编辑
摘要: #二进制转十进制 import sys import stdio n = int(sys.argv[1]) #接受从命令行传入的第一个参数 v = 1 while v 0: if v > n: stdio.write(0) else: stdio.write(1) n -= v v //= 2 stdio.wri... 阅读全文
posted @ 2017-07-31 14:18 跳过了E 阅读(177) 评论(0) 推荐(0) 编辑