第19775题 单选题
给定C++代码及期望输出,选出正确的说法

已知如下C++代码和输入N=10后的期望输出,判断相关说法的正确性:

int i,j;
int last, N;

cout << "请输入层数N:";
cin >> N;

last = 1;
for (i = 1; i < N; i++){
 for (j = 1; j < i + 1; j++){ // L1
  if (last > 9)
   last = 1;

  cout << last << " ";
  last += 1;
 }
 printf("\n");
}

输入N=10后期望输出如下:

请输入层数N:10
1
3
2 3
4 4
5 6
5 7 8 9 1
6 2 3 4 5 6 7
7 8 9 1 2 3
8 4 5 6 7 8 9 1
9 2 3 4 5 6 7 8 9
10 1 2 3 4 5 6 7 8 9
{{ option.label }}
子题{{ index + 1 }} {{ child.type_label }}
{{ option.label }}
✓ 正确 ◐ 部分正确 ✗ 错误
程序运行统计
暂无判题统计
提交{{ questionInfo.stats ? questionInfo.stats.submit_count : 0 }}次 正确率{{ statsAccuracy }}%
答案解析