bryce1010模板

http://acm.hdu.edu.cn/showproblem.php?pid=6313

参考dls的讲解:

以5*5的矩阵为例:

后一列分别对前一列+0+1+2+3+4操作:

+0:10000 10000 10000 10000 10000

+1:10000 01000 00100 00010 00001

+2:10000 00100 00001 01000 00010

+3:10000 00010 10000 00100 00001

+4:10000 00001 01000 00010 10000

然后sqrt(2000)接近47

所以设n=47;

找到一个规律公式:

gg[i*n+j][k*n+(j*k+i)%n]=1;

0<=i<47;0<=j<47;0<=k<47;

#include<bits/stdc++.h>
using namespace std;
const int n=47;
const int MAXN=3333;
int gg[MAXN][MAXN]; int main()
{
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
for(int k=0;k<n;k++)
gg[i*n+j][k*n+(j*k+i)%n]=1;
cout<<2000<<endl;
for(int i=0;i<2000;i++)
{
for(int j=0;j<2000;j++)
{
cout<<gg[i][j];
}
cout<<endl;
}
return 0; }

hdu6313( 2018 Multi-University Training Contest 2)的更多相关文章

  1. ( 2018 Multi-University Training Contest 2)

    2018 Multi-University Training Contest 2) HDU 6311 Cover HDU 6312 Game HDU 6313 Hack It HDU 6314 Mat ...

  2. HDU4888 Redraw Beautiful Drawings(2014 Multi-University Training Contest 3)

    Redraw Beautiful Drawings Time Limit: 3000/1500 MS (Java/Others)    Memory Limit: 65536/65536 K (Jav ...

  3. HDU 5726 GCD (2016 Multi-University Training Contest 1)

      Time Limit: 5000MS   Memory Limit: 65536KB   64bit IO Format: %I64d & %I64u Description Give y ...

  4. HDU 4897 Little Devil I(树链剖分)(2014 Multi-University Training Contest 4)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4897 Problem Description There is an old country and ...

  5. HDU 4906 Our happy ending(2014 Multi-University Training Contest 4)

    题意:构造出n个数 这n个数取值范围0-L,这n个数中存在取一些数之和等于k,则这样称为一种方法.给定n,k,L,求方案数. 思路:装压 每位 第1为表示这种方案能不能构成1(1表示能0表示不能)   ...

  6. (2018 Multi-University Training Contest 3)Problem D. Euler Function

    //题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6322 //题目大意:给定 k,求第 k 小的数 n,满足 φ(n) 是合数.显然 φ(1) = 1 ...

  7. hdu6315( 2018 Multi-University Training Contest 2)

    bryce1010模板 http://acm.hdu.edu.cn/showproblem.php?pid=6315 /*hdu 1007 首先我们在建立线段树之前应该思考的是线段树的节点维护一个什么 ...

  8. hdu6314( 2018 Multi-University Training Contest 2)

    bryce1010模板 http://acm.hdu.edu.cn/showproblem.php?pid=6314 ----. 又是一个数学题! 这个题使用容斥原理解决的,现场看dls推公式. 我也 ...

  9. hdu6311( 2018 Multi-University Training Contest 2)

    bryce1010模板 http://acm.hdu.edu.cn/showproblem.php?pid=6311 从dls思路中,我整理一下自己的思路: 1.首先也是建图 2.建图结束后,一个df ...

随机推荐

  1. 异常描述:hibernate懒加载中,用OpenSessionInViewFilter解决之后,同时对一个collection创建两个session访问导致异常(Illegal attempt to associate a collection with two open sessions)

    在保存的时候如果使用以下方法就会报错 解决:使用merge()方法就可以解决异常... merge()方法的解释: 传入的参数在数据库中不存在的时候会添加一条数据,根据主键判断已存在的时候会更新这条数 ...

  2. 坡道定点停车30cm

    坡道定点停车与起步是科目二五项必考之一,想要顺利通过该项考试,学员需要掌握两个要点,一个是车身距离右侧边线30cm以内的距离,一个是定点时机.本期,元贝小编先和大家分享半坡起步右边30公分怎么看.   ...

  3. .cxx_destruct crash

    开发过程中遇到 YXTBaseLabelCell .cxx_destruct崩溃,查了下,会在调用类的dealloc方法时调用cxx_destruct,于是看了下代码,找dealloc可能会崩溃的原因 ...

  4. 【Selenium】IE浏览器启动问题

    DesiredCapabilities ieCapabilities = DesiredCapabilities.internetExplorer();ieCapabilities.setCapabi ...

  5. hdu 1209 Clock(排序)

    题意:按钟表的时针.分针的夹角对5个时间进行升序排序,输出第3个时间 思路:排序 注意:若夹角相同,则按时间进行升序排序 #include<iostream> #include<st ...

  6. AtrousConvolution和dilated convolution

    唉,真烦哪些炒概念的,把整个世界都给弄乱了. 这里说一下dilated convolution和atrous convolution. 这两种是一样的,至少keras源码中是一样的.在keras中调用 ...

  7. 【CQ18高一暑假前挑战赛2】标程

    [昨晚打校赛,5个小时打完很累了,所以搞忘出题了...对不起学弟们,不过出的题都亲自写过一遍,可以保证题目和代码长度都不长,题目难度不大] [A:bush博弈] #include<bits/st ...

  8. [HAOI 2012] 外星人

    [题目链接] https://www.lydsy.com/JudgeOnline/problem.php?id=2749 [算法] 首先 , 每次对一个数x进行操作 , 只会使该数减少一个2的因子 那 ...

  9. 算法实现c语言--03

    实现  mystrcpy(), mystrcmp(), mystrcat(), mystrlen() ; #include<stdio.h> #include<stdlib.h> ...

  10. poi word 转html (.DOC .DOCX )

    注:不支持图片,支持表格 package com.bjhy.platform.report.commons; import java.io.BufferedWriter; import java.io ...