Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
114464 | 黄梓皓 | 100~999的水仙花数 | C++ | Compile Error | 0 MS | 0 KB | 323 | 2025-03-22 13:04:20 |
#include<bits/stdc++.h> using namespace std; int main() { for (int i = 100; i <= 999; i++) { int ge, shi, bai; int ge=i/100; int shi=i%100/10; int bai=i%100/100; int sum = ge * ge * ge + shi * shi * shi + bai * bai * bai; if (i == sum) { cout << i << " "; } } return 0; }
Main.cc: In function 'int main()': Main.cc:6:13: error: redeclaration of 'int ge' int ge=i/100; ^ Main.cc:5:7: note: 'int ge' previously declared here int ge, shi, bai; ^ Main.cc:7:13: error: redeclaration of 'int shi' int shi=i%100/10; ^ Main.cc:5:11: note: 'int shi' previously declared here int ge, shi, bai; ^ Main.cc:8:13: error: redeclaration of 'int bai' int bai=i%100/100; ^ Main.cc:5:16: note: 'int bai' previously declared here int ge, shi, bai; ^