当前位置:网站首页>PTA (daily question) 7-69 narcissus number
PTA (daily question) 7-69 narcissus number
2022-07-29 00:22:00 【Little Deng programmer who can write bugs】
Enter two 3 Bit positive integer m,n, Output [m,n] All in the interval “ Narcissistic number ”. So-called “ Narcissistic number ” It means a 3 digit , The sum of the cubes of the numbers is equal to the number itself .
Input format :
Test data consists of multiple groups , Processing to the end of the file . Enter two... For each set of tests 3 Bit positive integer m,n(100≤m<n≤999).
Output format :
For each group of tests , if [m,n] If there is no daffodil number in the interval, it will be output “none”( Quotation marks do not have to be output ), Otherwise, the number of all daffodils in the interval is output line by line , For the format of each line of output, please refer to the output sample .
sample input :
100 150
100 200
sample output :
none
153=1*1*1+5*5*5+3*3*3
Code :
try:
while True:
m, n = map(int, input().split())
flag = 1
for i in range(m, n+1):
a, b, c = [int(x) for x in list(str(i))] # Use this , This is it. python The power of
# a = i//100
# b = i//10%10
# c= i%10
if a*a*a + b*b*b + c*c*c == i:
flag = 0
print(f'{
i}={
a}*{
a}*{
a}+{
b}*{
b}*{
b}+{
c}*{
c}*{
c}')
if flag:
print('none')
except EOFError:
pass

边栏推荐
- Introduction and solution of common security vulnerabilities in web system CSRF attack
- 研发效能的道法术器
- Solution: direct local.Aar file dependencies are not supported when building an aar
- Idea error running 'application' command line is too long solution
- MySQL的存储过程
- 【MySQL系列】MySQL数据库基础
- Develop effective Tao spell
- Applet verification code login
- Locally connect to redis on Windows Server
- 总结:POD与容器的区别
猜你喜欢

Field injection is not recommended solution
![[MySQL series] MySQL database foundation](/img/50/cc75b2cdf6e52714c1d492fa1ae2c4.png)
[MySQL series] MySQL database foundation

聊聊异步编程的 7 种实现方式

MySQL事务(transaction) (有这篇就足够了..)

Es6操作教程

vulnhub:BTRSys2

Locally connect to redis on Windows Server

动态规划问题(六)

Install MySQL using Yum for Linux

Solution: direct local.Aar file dependencies are not supported when building an aar
随机推荐
IDEA2021.2安装与配置(持续更新)
R语言怎么学
Real time data warehouse: Netease strictly selects the practice of real-time data warehouse based on Flink
还在写大量 if 来判断?一个规则执行器干掉项目中所有的 if 判断...
Advanced area of attack and defense world web masters unserialize3
Idea error running 'application' command line is too long solution
2022网络安全学习路线 非常详细 推荐学习
Samsung asset management (Hong Kong) launched yuancosmos ETF to focus on investing in the future tuyere track
centos7安装mysql8
Concurrency in go
递归/回溯刷题(中)
JS four formulas for judging data types
Google browser, no installation required
Three years after graduation, write to you and me who may be confused [turn]
curl (7) Failed connect to localhost8080; Connection refused
Erc20 Standard Code
Linux下安装Mysql5.7,超详细完整教程,以及云mysql连接
CV instance segmentation model sketch (1)
Idea2021.2 installation and configuration (continuous update)
The difference between {} and ${}