20 Runtime Error
-------------------- Segmentation fault. #0 0x000000000040111f in main () at foo.cc:12 12 a[x][y]=now;
# | 状态 分数 | 耗时 | 内存占用 |
---|---|---|---|
#1 | Runtime Error 0 | 3ms | 536 KiB |
#2 | Runtime Error 0 | 3ms | 548 KiB |
#3 | Runtime Error 0 | 2ms | 324 KiB |
#4 | Runtime Error 0 | 3ms | 324 KiB |
#5 | Runtime Error 0 | 3ms | 764 KiB |
#6 | Runtime Error 0 | 3ms | 764 KiB |
#7 | Runtime Error 0 | 3ms | 536 KiB |
#8 | Accepted 10 | 3ms | 764 KiB |
#9 | Runtime Error 0 | 3ms | 552 KiB |
#10 | Accepted 10 | 3ms | 536 KiB |
代码
#include<bits/stdc++.h>
using namespace std;
int a[20][20],now=1,x=1,y=0,flg=0;
int main(){
int n;
cin>>n;
for(int i=0;i<n;i++){
x=n-i;
flg=0;
y=1;
while(x<=n){
a[x][y]=now;
now++;
if(x+y==6)flg=1;
if(flg)x++;
else y++;
}
}
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){
printf("%4d",a[i][j]);
}
printf("\n");
}
return 0;
}
信息
- 递交者
- 题目
- P369 练63.3 迂回方阵
- 语言
- C++17(O2)
- 代码长度
- 388 Bytes
- 递交时间
- 2024-12-2 20:15:47
- 评测时间
- 2024-12-2 20:15:56
- 分数
- 20
- 总耗时
- 28ms
- 峰值时间
- 3ms
- 峰值内存
- 764 KiB