题解 | #输出水仙花数#
输出水仙花数
https://www.nowcoder.com/practice/dabaf13009ef4d0cbf22302fd6a530a6
#include <iostream>
#include <cmath>
using namespace std;
int main() {
// write your code here......
for(int i = 100; i < 1000; ++i){
if(i == pow(i / 100, 3) + pow(i % 10, 3) + pow((i / 10) % 10, 3))
cout<<i<<endl;
}
return 0;
}

查看7道真题和解析