#include <iostream> int main() { for(int r=0; r<5; ++r){ for(int c=0; c<5; ++c){ int R = c<=r ? c : 4-c, C = c<=r ? 4-r : r, RC = R+C, v = (RC*(RC+1)/2 +1) + ((RC%2==1) ? R : C); if(c>r){ v = 26-v; } std::cout.width(3); std::cout << v << ','; } std::cout << '\n'; } }
Standard input is empty