URAL 1979 Resources Distribution

【题意】

【解题方法】构造!SPJ!
【代码】
//
//Created by just_sort 2016/10/28
//Copyright (c) 2016 just_sort.All Rights Reserved
//

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/hash_policy.hpp>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
using namespace __gnu_pbds;
typedef long long LL;
typedef pair<int, LL> pp;
#define MP(x,y) make_pair(x,y)
const int maxn = 200005;
const int N = 1005;
const int M = 2010;
const int inf = 0x3f3f3f3f;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>order_set;
//head

//ural 1979

int n, mp[1300][1300];

int main()
{
    cin>>n;
    int num = 1;
    //1
    for(int i = 1; i <= n; i++)
    {
        for(int j = 1; j <= n; j++)
        {
            mp[3*n-i+1][j] = 6*n*n-num+1;
            mp[i][j] = num++;
        }
    }
    for(int i = n+1; i <= n*2; i++)
    {
        for(int j = 1; j <= n; j++)
        {
            mp[i][n*3-j+1] = 6*n*n-num+1;
            mp[i][j] = num++;
        }
        for(int j = n+1; j <= 2*n; j++)
        {
            mp[i][n*5-j+1] = 6*n*n-num+1;
            mp[i][j] = num++;
        }
    }
    //2
    for(int i = 1; i <= n; i++)
    {
        for(int j = 1; j <= n; j++)
        {
            printf("%d%c",mp[i][j],j==n?'\n':' ');
        }
    }
    for(int i = n+1; i <= n*2; i++)
    {
        for(int j = 1; j <= n*4; j++)
        {
            printf("%d%c",mp[i][j],j==n*4?'\n':' ');
        }
    }
    for(int i = n*2 + 1; i <= n*3; i++)
    {
        for(int j = 1; j <= n; j++)
        {
            printf("%d%c",mp[i][j],j==n?'\n':' ');
        }
    }
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值