文章

21

粉丝

0

获赞

6

访问

1.5k

头像
水仙花数 题解:
P1034 中南大学机试题
发布于2026年1月25日 15:02
阅读数 51

常规方法POW加取模拿位数

 

#include <iostream>
#include <cmath>  // 必须包含 cmath

using namespace std;

bool sx(int n){
    int temp=n;
    int ans=0;
    while(temp>0){
        int k=temp%10;
        temp=temp/10;
        ans+=pow(k,3);
    }
    if(ans==n){
        return true;
    }
    return  false;
}
int main() {
    int m,n;
    
    while(cin>>m>>n){
        if(m==0&&n==0){
            break;
        }
        bool flag=false;
        for(int i=m;i<=n;i++){
        &...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发