#include <stdio.h> #define N 40 int main() { int a[N] = { 0 }, i, k, t; for (k = 0, i = 1; k < N; i += 2) { t = i; while (t-- && k < N) a[k++] = i; } for (i = 0; i < N; i++) printf("%d ", a[i]); return 0; }
[此贴子已经被作者于2023-5-23 12:08编辑过]