Codeforces Round #593 (Div. 2) C. Labs

Topic: https://codeforces.com/contest/1236/problem/C

Ideas: The number n ^ 2 lab level group into n

   group A and B of the ordered pair (u, v), u∈A, v∈B when u> v effective This ordered, selecting the maximum value

   1 will be easy to find on the group 1,2 in group 2,3 on group 3, ......, n on the group n, n + 1 on the group n, n + 2 in group n- 2, ......., 2n is placed on group 1,2n + 1 group

           1, ...... res maximum

#include <bits/stdc++.h>
 
using namespace std;
 
int n;
 
int main ()
{
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<n;j++)
        {
            if((j&1)==0) printf("%d ",n*(n-j)-i);
            else printf("%d ",n*(n-j-1)+1+i);
        }
        printf("\n");
    }
    return 0;
}

Guess you like

Origin www.cnblogs.com/c4Lnn/p/12093276.html