#include <iostream> int main() { int const S = 11; for(int r=0; r<S; ++r){ for(int c=0; c<S; ++c){ bool TR = c>r; int R = TR ? S-1-c : c, C = TR ? r : S-1-r, RC = R+C, v = RC*(RC+1)/2 +1 + (RC%2 ? R : C); if(TR){ v = S*S+1-v; } std::cout.width(3); std::cout << v << ','; } std::cout << '\n'; } }
Standard input is empty
66, 67, 85, 86,100,101,111,112,118,119,121, 46, 65, 68, 84, 87, 99,102,110,113,117,120, 45, 47, 64, 69, 83, 88, 98,103,109,114,116, 29, 44, 48, 63, 70, 82, 89, 97,104,108,115, 28, 30, 43, 49, 62, 71, 81, 90, 96,105,107, 16, 27, 31, 42, 50, 61, 72, 80, 91, 95,106, 15, 17, 26, 32, 41, 51, 60, 73, 79, 92, 94, 7, 14, 18, 25, 33, 40, 52, 59, 74, 78, 93, 6, 8, 13, 19, 24, 34, 39, 53, 58, 75, 77, 2, 5, 9, 12, 20, 23, 35, 38, 54, 57, 76, 1, 3, 4, 10, 11, 21, 22, 36, 37, 55, 56,