while not (pa == len(a)-1 and pb == len(b)-1 and pc == len(c)-1): na, nb, nc = a[pa], b[pb], c[pc] curDiff = max(abs(na-nb), abs(na-nc), abs(nb-nc)) if curDiff < minDiff: minDiff = curDiff ma, mb, mc = na, nb, nc if na<=nb and na<=nc: if pa < len(a)-1: pa += 1 else: break elif nb<=na and nb<=nc: if pb < len(b)-1: pb += 1 else: break else: if pc < len(c)-1: pc += 1 else: break return ma, mb, mc
import random a = sorted([int(random.uniform(0, 100)) for i in range(15)]) b = sorted([int(random.uniform(0, 100)) for i in range(15)]) c = sorted([int(random.uniform(0, 100)) for i in range(15)]) print(a) print(b) print(c) print(getMinDiffTriplet(a, b, c)) 输出: [7, 13, 25, 26, 31, 31, 50, 52, 52, 58, 58, 69, 71, 87, 96] [3, 28, 28, 33, 38, 45, 46, 49, 67, 69, 71, 78, 84, 87, 98] [17, 18, 21, 34, 36, 46, 53, 54, 65, 72, 79, 80, 82, 85, 93] (71, 71, 72)
【在 r****e 的大作中提到】 : 昨天在weis找到rebate form,今天去买p&g25返10做rebate,第一次在receipt上出现5 : off 15,但是6/8就到期。下周有啥可以买的吗?
x5
23 楼
呵呵,这个跨度比较大
【在 z****6 的大作中提到】 : 还在徘徊纠结中,Nikon, Voigtlander or Olympus
S*n
24 楼
我弄错了
【在 r**h 的大作中提到】 : 不sort你怎么知道哪个数组的指针要往前呢
a*u
25 楼
pai
s*g
26 楼
Leica吧 省心
【在 z****6 的大作中提到】 : 还在徘徊纠结中,Nikon, Voigtlander or Olympus
s*g
27 楼
pai baozi
【在 r****e 的大作中提到】 : 昨天在weis找到rebate form,今天去买p&g25返10做rebate,第一次在receipt上出现5 : off 15,但是6/8就到期。下周有啥可以买的吗?
S*M
28 楼
I have all 3, haha Nikon FE 24/2.8 bessa r3a 40/1.4 mjuII mjuII is the most frequently used and produced the most garbage shot
【在 z****6 的大作中提到】 : 还在徘徊纠结中,Nikon, Voigtlander or Olympus
z*6
29 楼
说说FE vs R3A吧
【在 S*M 的大作中提到】 : I have all 3, haha : Nikon FE 24/2.8 : bessa r3a 40/1.4 : mjuII : mjuII is the most frequently used and produced the most garbage shot
S*M
30 楼
I value aperture priority on my 135 manual focus camera so in that regard, both are vely good Haven't used either in a looooong time Been shooting 66 and 67 almost exclusively