C++水仙花数

默认分类 | 2020-02-24 00:03:42 | 阅读 331 次 | 评论(0)


 int aa = 111, aaa = 0, aaaa = 0, a = aa;
 while (a < 999)
 { //缘由https://bbs.bccn.net/viewthread.php?tid=499370&pid=2719622&page=1#pid2719622
  if (aa)aaa = aa % 10, aaaa += aaa*aaa*aaa, aa /= 10;
  else
  if (a == aaaa)cout << a << ends, aa = ++a, aaaa = 0; else aa = ++a, aaaa = 0;
 }
无标题.png (上传于2020-02-24 00:03:42)
无标题.png


文章评论,共0条
游客请输入验证码
最新评论