文章

40

粉丝

512

获赞

90

访问

382.8k

头像
签到
Ang VIP
P1034 中南大学机试题
发布于2020年3月12日 14:57
阅读数 7.9k

  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main(){
  4. int n,m;
  5. while(cin>>m>>n){
  6. if(n==0&&m==0){
  7. break;
  8. }
  9. bool flag = false;
  10. for(int i=m;i<=n;i++){
  11. int temp=i;
  12. int a = temp % 10;
  13. temp /= 10;
  14. int b=temp % 10;
  15. temp /= 10;
  16. int c=temp;
  17. if(a*a*a+b*b*b+c*c*c == i){
  18. cout<<i<<" ";
  19. flag=true;
  20. }
  21. }
  22. if(!flag){
  23. cout<<"no"<<endl;
  24. }else{
  25. cout<<endl;
  26. }
  27. }
  28. }

 

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发