14 条题解

  • 1
    @ 2023-2-2 15:01:46

    用坐标想

    挺多坑的

    #include <iostream>
    #include <stack>
    #include <cmath>
    #include <vector>
    #include <string.h>
    #include <queue>
    #include <stdio.h>
    #include <iomanip>
    #include <cstdio>
    #include <algorithm>
    #define int long long
    using namespace std;
    const int N = 1e5 + 10;
    const int INF = 0x3f3f3f3f;
    int a[N], n;
    signed main()
    {
    	cin >> n;
        for(int i = 1; i <= n; i++)
        {
            cin >> a[i];
        }
        for(int i = 1; i <= n; i++)
        {
            for(int j = 1; j <= n; j++)
            {
                int k = i + j;
                if(k <= n + 1)
                {
                    cout << a[k - 1] << " ";
                }
                else if(k < n * 2)
                {
                    cout << a[k % n - 1] << " ";
                }
                else
                {
                    cout << a[n - 1] << " ";
                }
            }
            puts("");
        }
    	return 0;
    }
    

    信息

    ID
    1049
    时间
    1000ms
    内存
    128MiB
    难度
    4
    标签
    递交数
    329
    已通过
    160
    上传者