0 Runtime Error
-------------------- Segmentation fault. #0 0x0000000000401398 in main () at foo.cc:19 19 a[h][l] = k++;
# | 状态 分数 | 耗时 | 内存占用 |
---|---|---|---|
#1 | Runtime Error 0 | 3ms | 288 KiB |
#2 | Runtime Error 0 | 3ms | 320 KiB |
#3 | Runtime Error 0 | 3ms | 536 KiB |
#4 | Runtime Error 0 | 3ms | 536 KiB |
#5 | Runtime Error 0 | 3ms | 532 KiB |
#6 | Runtime Error 0 | 3ms | 536 KiB |
#7 | Runtime Error 0 | 3ms | 536 KiB |
#8 | Wrong Answer 0 | 3ms | 764 KiB |
#9 | Runtime Error 0 | 3ms | 536 KiB |
#10 | Wrong Answer 0 | 3ms | 324 KiB |
代码
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
int N;
cin >> N;
int a[N][N];
int k = 1;
int h = 0, l = 0;
int hy = 0;
for (int i = 0; i < N; i++) {
h = N - hy;
l = 0;
for (; l != N; l++) {
a[h][l] = k++;
}
l--;
for (; h != N; h++) {
a[h][l] = k++;
}
hy++;
}
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
cout << setw(4) << a[i][j];
}
cout << endl;
}
return 0;
}
信息
- 递交者
- 题目
- P369 练63.3 迂回方阵
- 语言
- C++14
- 代码长度
- 579 Bytes
- 递交时间
- 2025-1-10 16:51:18
- 评测时间
- 2025-1-10 16:51:20
- 分数
- 0
- 总耗时
- 29ms
- 峰值时间
- 3ms
- 峰值内存
- 764 KiB