ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

找三个数吧,a+b+c=1000,and a^2+b^2=c^2

2022-06-23 11:35:26  阅读:21  来源: 互联网

标签:end start range 三个 time 1001 1000


#if u want three num when a+b+c=1000,and a^2+b^2=c^2

import os
import time

start_time = time.time()
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))
end_time = time.time()
print("all time: %d" %(end_time-start_time))

 

标签:end,start,range,三个,time,1001,1000
来源: https://www.cnblogs.com/KingOfHuan/p/16404405.html

专注分享技术,共同学习,共同进步。侵权联系[admin#icode9.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有