Malones


私信TA

用户名:Malones

访问量:3787

签 名:

seize the day

等  级
排  名 1512
经  验 2736
参赛次数 0
文章发表 22
年  龄 0
在职情况 学生
学  校
专  业

  自我简介:

解题思路:
首位为0不输出

参考代码:

#include<bits/stdc++.h>
using namespace std;
int main(){
    int t1, t2, t3, t4, t5, t6;
    for( t1 = 0; t1 < 10; t1++)
        for(t2 = 0; t2 < 10; t2++)
            for( t3 = 1; t3 < 10; t3++)
                for( t4 = 0; t4 < 10; t4++)
                    for( t5 = 0; t5 < 10; t5++)
                        for( t6 = 0; t6 < 10; t6++)
                            if( pow(t1,5)+pow(t2,5)+pow(t3,5)+pow(t4,5)+pow(t5,5)+pow(t6,5)==t1*100000+t2*10000+t3*1000+t4*100+t5*10+t6)
                                if( t1 != 0)   //首位不为零全部输出
                                    cout << t1 << t2 << t3 << t4 << t5 << t6 << endl;
                                else   //首位为零不输出t1
                                    if( t2 != 0)
                                        cout << t2 << t3 << t4 << t5 << t6 << endl;
                                    else   //四位数时不输出t1、t2
                                        cout << t3 << t4 << t5 << t6 << endl;
    return 0;
}


 

0.0分

0 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换

万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区