zoukankan      html  css  js  c++  java
  • 杭电多校第二场 1005 hack it

    题意: 构造一个n*n 的 01 矩阵, 0 < n < 2001,  矩阵需要满足没有一个子矩阵的4个角都是1,并且矩阵内1的个数至少有85000个。

    题解:数论构造题

    参考From

    代码:

     1 #include<bits/stdc++.h>
     2 using namespace std;
     3 #define Fopen freopen("_in.txt","r",stdin); freopen("_out.txt","w",stdout);
     4 #define LL long long
     5 #define ULL unsigned LL
     6 #define fi first
     7 #define se second
     8 #define pb push_back
     9 #define lson l,m,rt<<1
    10 #define rson m+1,r,rt<<1|1
    11 #define max3(a,b,c) max(a,max(b,c))
    12 #define min3(a,b,c) min(a,min(b,c))
    13 typedef pair<int,int> pll;
    14 const int inf = 0x3f3f3f3f;
    15 const LL INF = 0x3f3f3f3f3f3f3f3f;
    16 const LL mod =  (int)1e9+7;
    17 int P = 47;
    18 const int N = 3010;
    19 int a[N][N];
    20 int main(){
    21     int n, m;
    22     for(int i = 0; i < P; i++)
    23         for(int j = 0; j < P; j++)
    24             for(int k = 0; k < P; k++)
    25                 a[i*P + j][k*P + (k*i+j)%P] = 1;
    26     puts("2000");
    27     for(int i = 0; i < 2000; i++){
    28         for(int j = 0; j < 2000; j++)
    29             printf("%d", a[i][j]);
    30         puts("");
    31     }
    32     return 0;
    33 }
    View Code
  • 相关阅读:
    eclipse中的项目如何打成war包
    【SVN】Please execute the 'Cleanup' command.
    2021.06.02模拟赛DP2
    2021.05.26模拟赛 DP1
    状压DP
    高斯消元
    矩阵快速幂
    2021.05.10讲题
    Luogu P2152[SDOI 2009]Super GCD
    Tarjan
  • 原文地址:https://www.cnblogs.com/MingSD/p/9375760.html
Copyright © 2011-2022 走看看