Thought enumeration method a = 0 ~ 1000 b = 0 ~ 1000 c = 0 ~ 1000
Most low side corresponds to three times the iteration plus a print operation and a determination O (n ^ 3 * 2)
for a in range(0,1001): for b in range(0,1001): for c in range(0,1001): if a+b+c==1000 and a**2 + b**2 == c**2: print('a,b,c:%d,%d,%d',(a,b,c))
Relatively good O ((n ^ 2) * 3)
for a in range(0,1001): for b in range(0,1001): c=1000-a-b if a**2 + b**2 == c**2: print('a,b,c:%d,%d,%d',(a,b,c))
A program that is running a speed corresponding to computational problems, but also possible to configure the machine on issues
Big O notation: asymptotic function to take a corresponding function corresponding to a formula expressed distal shunt removed, put the final result is called the large time complexity of O represents
order
cycle
condition