HUST 1353 Dartboard】的更多相关文章

构造.应该有多种构造方法.做的时候WA了好几发,怀疑做法是错的,事实上是代码写搓了.. 我是这样构造的:先从上往下左右放奇数,再从下往上左右填偶数 (一)如果n/2是偶数(以12为例) 左边列是内环,右边列是外环 (二)如果n/2是奇数(以10为例) 左边列是内环,右边列是外环 #include <stdio.h> #include <algorithm> #include <string.h> #include <queue> #include <s…
1017 - Exact cover 时间限制:15秒 内存限制:128兆 自定评测 5584 次提交 2975 次通过 题目描述 There is an N*M matrix with only 0s and 1s, (1 <= N,M <= 1000). An exact cover is a selection of rows such that every column has a 1 in exactly one of the selected rows. Try to find o…
#HUST deb http://mirrors.hust.edu.cn/ubuntu/ xenial main restricted universe multiverse deb http://mirrors.hust.edu.cn/ubuntu/ xenial-security main restricted universe multiverse deb http://mirrors.hust.edu.cn/ubuntu/ xenial-updates main restricted u…
1017 - Exact cover Problem's Link:   http://acm.hust.edu.cn/problem/show/1017 Mean: 给定一个由0-1组成的矩阵,是否能找到一个行的集合,使得集合中每一列都恰好包含一个1 analyse: 初学DLX. 这是DLX处理的最简单的问题,也是模板题. Time complexity: O(n*d) Source code:  #include <stdio.h> #include <string.h> #…
题目传送门 /* 题意:1~1e9的数字里,各个位数数字相加和为s的个数 递推DP:dp[i][j] 表示i位数字,当前数字和为j的个数 状态转移方程:dp[i][j] += dp[i-1][j-k],为了不出现负数 改为:dp[i][j+k] += dp[i-1][j] */ #include <cstdio> #include <cstring> #include <cmath> #include <algorithm> #include <str…
题目链接:http://acm.hust.edu.cn/problem/show/1010 KMP失配指针的利用: next数组前缀和后缀最长公共长度,这样len - next[len];就是最短的循环节点. #include <stdio.h> #include <string.h> using namespace std; #define maxn 1000005 void getFail(char *P,int *f) { int m = strlen(P); f[] = ;…
题目链接 题意 : 让你找出1到10^9中和为s的数有多少个. 思路 : 自己没想出来,看的题解,学长的题解报告 题解报告 //URAL 1353 #include <iostream> #include <stdio.h> #include <string.h> using namespace std; ][] ; int main() { int s ; memset(dp,,sizeof(dp)) ; ; i < ; i++) { dp[][i] = ; d…
http://acm.timus.ru/problem.aspx?space=1&num=1353 #include <cstdio> #include <cstring> #include <algorithm> using namespace std; ][]; void inti() { memset(dp,,sizeof(dp)); dp[][]=; ; i<=; i++) { ; j<=i*; j++) { ; k<=; k++) {…
题目链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=65998#problem/A 题意:求01矩阵的精确覆盖. DLX学习资料:http://www.cnblogs.com/grenet/p/3145800.html http://blog.csdn.net/mu399/article/details/7627862 #include <cstdio> #include <cstring> #include <…
DESCRIPTION There is an N*M matrix with only 0s and 1s, (1 <= N,M <= 1000). An exact cover is a selection of rows such that every column has a 1 in exactly one of the selected rows. Try to find out the selected rows. INPUT There are multiply test ca…