//#pragma comment(linker, "/STACK:1024000000,1024000000")#include #include #include #include #include #include #include #include #include #include #include #include #include
还是这个比较简单:
for (int i = 0; i < 2*n - 1; ++i) { for (int j = 0; j < n; ++j) { if (i - j < 0 || i - j >= n) continue; b[i].push_back(a[j][i - j]); } }