[水]ZOJ2736

来源:互联网 发布:动画规律软件 编辑:程序博客网 时间:2024/05/01 13:19

如果一个数是其每一位的平方和就输出yes 不然就输出no

#include<bits/stdc++.h>using namespace std;int tqr(int x){    return x*x*x;}int main(){    int n;    char a[10];    while (scanf("%s",a)!=EOF)    {        int tem1=0,tem2=0;        for (int i=0;i<3;i++)            tem1=tem1*10+a[i]-'0',tem2+=tqr(a[i]-'0');        if (tem1==tem2)            cout<<"Yes"<<endl;        else            cout<<"No"<<endl;    }    return 0;}




0 0
原创粉丝点击