當前位置:編程學習大全網 - 編程軟體 - acm編程入門壹題

acm編程入門壹題

#include<iostream>

#include<array>

using namespace std;

int main() {

int input;

int next = 1, x, y, z;

x = y = 1;

z = 1;

cin >> input;

array<array<int, 101>, 101> point;

//point[1][1] = 0;

bool flag = true;

while (flag) {

point[x][y] = next;

if (y == z) {

y = 1; z++;

}

else {

x--, y++;

}

if (z > input) {

flag = false;

continue;

}

next++;

}

for (int i = 1; i <= input; i++)

for (int j = 1; j <= input; j++) {

if (point[i][j] != 0) {

cout << point[i][j];

if (j != input) {

cout << ' ';

}

}

}

return 0;

}

這個有bug,妳先看看,等我想通了我在補充

  • 上一篇:VR培訓需要學習哪些內容
  • 下一篇:徐州擷秀中學學余班考試怎麽報名的
  • copyright 2024編程學習大全網