14 条题解

  • 0
    @ 2025-7-22 9:40:51
    #include <iostream>
    #include <cmath>
    using namespace std;
    
    int main(){
    	/*
    	声明即将要用到的变量 
    	num:输入的数字
    	unitsDigit:个位数字
    	tensDigit:十位数字
    	hundredsDigit:百位数字 
    	*/ 
    	int num,unitsDigit,tensDigit,hundredsDigit,sum;
    	
    	 
    	cin >> num;
    	hundredsDigit = num / 100;   //求百位的数字 
    	tensDigit = num % 100 / 10;  //求十位的数字 
    	unitsDigit = num % 10;	     //求个位的数字 
    	
    	sum = pow(unitsDigit,3) + pow(tensDigit,3) + pow(hundredsDigit,3);
    	
    	if (num == sum) {
    		cout << "YES"; 
    	}
    	else{
    		cout <<   "NO"; 
    	}
    		
    	
    	return 0;
    }
    
    
    
    
    
    
    
    
    

    信息

    ID
    884
    时间
    1000ms
    内存
    128MiB
    难度
    4
    标签
    递交数
    1046
    已通过
    459
    上传者