Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
120183 | 谭思宸 | 两个数的最小距离 | C++ | Compile Error | 0 MS | 0 KB | 588 | 2025-05-24 11:45:05 |
#include <iostream> #include <cmath> #include <cstdio> using namespace std; long long a[1005]; int main() { freopen("a.in", "r", stdin); freopen("a.out", "w", stdout); */ int n; long long t; cin >> n; for (int i = 1; i <= n; i++) { cin >> a[i]; } long long min = abs (a[1] - a[2]); for (int i = 1; i <= n; i++) { for (int j = i + 1; j <= n; j++) { t = abs(a[i] - a[j]); if (t < min) { min = t; } } } cout << min; return 0; }
Main.cc: In function 'int main()': Main.cc:9:6: error: expected primary-expression before '/' token */ int n; long long t; cin >> n; ^ Main.cc:9:8: error: expected primary-expression before 'int' */ int n; long long t; cin >> n; ^ Main.cc:9:35: error: 'n' was not declared in this scope */ int n; long long t; cin >> n; ^ Main.cc:7:33: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result] freopen("a.in", "r", stdin); ^ Main.cc:8:34: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result] freopen("a.out", "w", stdout); ^