Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
114468 | 何松羽 | 100~999的水仙花数 | C++ | Compile Error | 0 MS | 0 KB | 330 | 2025-03-22 13:08:44 |
#include<bits/stdc++.h> using namespace std; int main() { for (int i = 100; i <= 999; i++) { int a, b, c; int sum = a * a * a + b * b * b + c * c * c; if (i == sum) { cout << i << " "; } int a = n / 1000 / 10;//1 int b = n / 1000 % 10; //2 int c = n / 100 % 10; //3 } cout<<c<<b<<a; return 0; }
Main.cc: In function 'int main()': Main.cc:10:7: error: redeclaration of 'int a' int a = n / 1000 / 10;//1 ^ Main.cc:5:7: note: 'int a' previously declared here int a, b, c; ^ Main.cc:10:11: error: 'n' was not declared in this scope int a = n / 1000 / 10;//1 ^ Main.cc:11:7: error: redeclaration of 'int b' int b = n / 1000 % 10; //2 ^ Main.cc:5:10: note: 'int b' previously declared here int a, b, c; ^ Main.cc:12:7: error: redeclaration of 'int c' int c = n / 100 % 10; //3 ^ Main.cc:5:13: note: 'int c' previously declared here int a, b, c; ^ Main.cc:14:8: error: 'c' was not declared in this scope cout<