题目:
10000以内的一个整数,它加上100和加上268后都是一个完全平方数,请问该数是多少?
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
-------------------------------------------------
File Name: python练习100——【003】完全平方数
Description : python practice
Author : zhangzx
date: 2020-12-03
-------------------------------------------------
Change Activity:
2020-02-19
-------------------------------------------------
"""
import math
for i in range(10000):
k = int(math.sqrt(i + 100))
j = int(math.sqrt(i + 268))
if k*k == (i + 100 ) and j*j==(i + 268):
print(i)
---------------------------以下是输出-----------------------------
21
261
1581