当前位置:网站首页>Judge whether it is the sum of squares
Judge whether it is the sum of squares
2022-04-22 01:47:00 【Boundless universe PY】
import math
class Solution:
""" Parameters num Integers Returns a Boolean type """
def checkSumOfSquareNumbers(self, num):
# write your code here
if num < 0:
return False
for i in reversed(range(0, int(math.sqrt(num)) + 1)):
if i * i == num:
return True
j = num - i * i
k = int(math.sqrt(j))
if k * k == j:
return True
return False
if __name__=='__main__':
solution=Solution()
num=5
print(" Input is :",num)
print(" Output is :",solution.checkSumOfSquareNumbers(num))
版权声明
本文为[Boundless universe PY]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220143119586.html
边栏推荐
- C -- console operation
- 二十四节气之谷雨
- Fundamentals lecture 30 Lecture 9 geometric application of univariate function integration
- Memory leak caused by C UserControl
- Ch4inrulz target penetration test
- [untitled]
- [Acwing] 第 8 场周赛
- Appium移動端自動化測試--搭建模擬器和真機環境一
- C语言物流管理运输系统
- Ali expert original, self-taught programming, looking for a job
猜你喜欢

net easy

AnatomyNet: Deep Learning for Fast and Fully Automated Whole-volume Segmentation of Head and Neck An
Ali Daniel collates, Android interview multiple-choice questions

Net Easy

Webrtc video cannot be played. How to add UDP hole drilling program in easycvr?
![[server data recovery] successful cases of data recovery after the server is flooded](/img/b4/069c0b699e6bd6c4fc508e3178ec57.jpg)
[server data recovery] successful cases of data recovery after the server is flooded

播放量超2000w,这些高能恰饭视频为什么能被B站用户“反复观看”?

阿里专家原创,自学编程找工作

Ch4inrulz target penetration test

Isla obscura deep sea biological series NFT market platform
随机推荐
educoder -- ip包的分片
Codeforces Round #783 (Div. 2)
Cereal Mall - learning notes - Basic chapter - goods and services 1 (p45-p58)
DVWA series - XSS (cross site script injection (reflective, storage, DOM))
[编程题]扑克牌大小
MATLAB实现多元正态Copula分布
oracle安装server端
The sandbox and design egg have reached a cooperation to jointly establish a virtual space Como small world
Learning summary of computer network security technology
[several common buttons in swing]
DPI exception of window form dynamically created by WPF
Valley rain of 24 solar terms
JVM - GC垃圾回收器
Station B charging | charging more than 1500 a week, Yinfa up is the new dark horse of station B?
程序员的黑科技 | 每日趣闻
Leetcode1470. 重新排列数组
Ali expert original, self-taught programming, looking for a job
Interview list questions
(一)postman遇到报错:There was an error connecting to XXXX
理论,智慧,学习