Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
102649 | 王子毅 | 100~999的水仙花数 | C++ | Accepted | 0 MS | 268 KB | 364 | 2024-12-22 13:36:16 |
#include <iostream> #include <cmath> using namespace std; int main() { for (int num = 100; num < 1000; num++) { int hundreds = num / 100; int tens = (num / 10) % 10; int units = num % 10; if (num == pow(hundreds, 3) + pow(tens, 3) + pow(units, 3)) { cout << num << " "; } } return 0; }