1497748267


私信TA

用户名:1497748267

访问量:15208

签 名:

学校比赛,刷题走起

等  级
排  名 1337
经  验 2875
参赛次数 1
文章发表 25
年  龄 0
在职情况 学生
学  校 重庆邮电大学移通学院
专  业

  自我简介:

TA的其他文章

解题思路:

注意事项:

参考代码:

#include<iostream>
#include<cmath>
using namespace std;
int main()
{
	int n;
	int a, b, c;
	cin >> n;
	a = n / 100;
	b =n / 10 % 10;
	c = n % 10;
	if (int(pow(a, 3)) + int(pow(b, 3)) + int(pow(c, 3)) == n)
		cout << 1 << endl;
	else
		cout << 0 << endl;
	return 0;
}


 

0.0分

1 人评分

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

编程语言转换

万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区

#include<iostream>
#include<cmath>
using namespace std;

int main()
{
    int a,b,c,d,e;
    cout << "put a number" << endl;
    cin >> a;
    if(a/100>=1&&a/100<=9)
    {
        b=a/100;
        c=a%100/10;
        d=a%10;
        e=pow(b,3)+pow(c,3)+pow(d,3);
        if(a-e==0)
        {
            cout << "1" << endl;
        }
        else
        {
            cout << "0" << endl;
        }
        
    }
    else
    {
        cout << "0" << endl;
    }
    return 0;
}
这个为什么错了啊
2020-12-24 14:24:09
是不是应该先证明输入的数是三位数呢
2019-06-10 15:08:19
是不是应该先证明输入的数是三位数?不然输入1结果输出也是1
2019-06-10 15:07:58
为什么if语句里pow前需要用int啊,新手,求指教
2019-05-16 09:13:48
  • «
  • 1
  • »