hdu6313( 2018 Multi-University Training Contest 2)
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)的更多相关文章
- ( 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 ...
- 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 ...
- HDU 5726 GCD (2016 Multi-University Training Contest 1)
Time Limit: 5000MS Memory Limit: 65536KB 64bit IO Format: %I64d & %I64u Description Give y ...
- 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 ...
- HDU 4906 Our happy ending(2014 Multi-University Training Contest 4)
题意:构造出n个数 这n个数取值范围0-L,这n个数中存在取一些数之和等于k,则这样称为一种方法.给定n,k,L,求方案数. 思路:装压 每位 第1为表示这种方案能不能构成1(1表示能0表示不能) ...
- (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 ...
- hdu6315( 2018 Multi-University Training Contest 2)
bryce1010模板 http://acm.hdu.edu.cn/showproblem.php?pid=6315 /*hdu 1007 首先我们在建立线段树之前应该思考的是线段树的节点维护一个什么 ...
- hdu6314( 2018 Multi-University Training Contest 2)
bryce1010模板 http://acm.hdu.edu.cn/showproblem.php?pid=6314 ----. 又是一个数学题! 这个题使用容斥原理解决的,现场看dls推公式. 我也 ...
- hdu6311( 2018 Multi-University Training Contest 2)
bryce1010模板 http://acm.hdu.edu.cn/showproblem.php?pid=6311 从dls思路中,我整理一下自己的思路: 1.首先也是建图 2.建图结束后,一个df ...
随机推荐
- SCAU 还有两个东西 —— 异或
竞赛题 F 还有两个东西 Time Limit:400MS Memory Limit:65535K 题型: 编程题 语言: 无限制 描述 给出n( n >= 2 )个整数,其中有 2 个 ...
- WebDriver API——javascript的相关操作
有些时候webdriver是没法操作元素或浏览器的,这时候我们可以通过javascript来进行相关的操作,昨天在群里一个朋友定位一个显示框,总是无法定位点击,或者是点击无效,这个时候就可以用java ...
- PHP自定义网站根目录
1.打开httpd.conf配置文件(xampp下apache文件夹中的conf里) Ctrl + F 查找documentroot 找到结果 改好后保存,并重启apache
- Python: PS 滤镜--水波特效
本文用 Python 实现 PS 滤镜中的 水波特效 import numpy as np from skimage import img_as_float import matplotlib.pyp ...
- [转载] Android raw与assets区别
*res/raw和assets的相同点: 1.两者目录下的文件在打包后会原封不动的保存在apk包中,不会被编译成二进制. *res/raw和assets的不同点:1.res/raw中的文件会被映射到R ...
- shiro加密简单实现
1.添加shiro依赖 定义shiro的版本号 <shiro.ver>1.2.3</shiro.ver> 加入shiro的依赖 <dependency> <g ...
- IntelliJ IDEA 2018 设置代码提示对大小写不敏感
setting->Editor->General->Code Completion取消勾选Match case
- Ubuntu18.04 安装 JDK7
直接下载jdk压缩包方式安装 1.官网下载JDK 地址: http://www.oracle.com/technetwork/articles/javase/index-jsp-138363 ...
- POJ2752(next原理理解)
Seek the Name, Seek the Fame Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 15536 Ac ...
- POJ2823(优先队列)
Sliding Window Time Limit: 12000MS Memory Limit: 65536K Total Submissions: 50738 Accepted: 14590 ...