A boolean matrix has the parity property when each row and each column has an even sum, i.e. contains an even number of bits which are set. Here's a 4
转载 2017-03-09 18:34:00
36阅读
2评论
题目:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=4105大意:很多的函数
原创 2022-08-09 17:27:04
22阅读
DescriptionA boolean matrix has the parity property when each row and each column has an even
原创 2022-05-14 11:07:40
48阅读
A Apples and Ideas "If you have an apple and I have an apple and we exchange these apples then you and I will still each have one apple. But if you ha
转载 2016-04-23 17:50:00
80阅读
ZOJ3321 //there is at most one edge between two nodes. 因为这句话的局限性,又要满足环,那么一定是每个点度为2,然后为n节点的一个环 //#include #include#include#includeusing namespace std...
转载 2017-02-11 13:12:00
312阅读
2评论
题意给出甲乙丙三人的能力值关系:甲的能力值确定是 2 位正整数;把甲的能力值的 2 个数字调换位置就是乙的能力值;甲乙两人能力差是丙的能力值的 X 倍;乙的能力值是丙的 Y 倍。输入为你的能力值,X,Y输出甲的能力值,以及甲乙丙三人和你的关系(‘ping’=,‘cong’>,‘gai’<)本题先根据X,Y值求出甲乙丙的能力值,因为甲是两位数,这里可以使用两个for循环分别作为十位和个位
转载 2023-06-28 00:25:10
65阅读
HanioTower的加强版记f[n][m]为n个disc,m个peg的Hanoi问题,则有dp公式f[n][m]=min{f[n-k][m-1]+2*f[k][m]}。即把上面的k个disc利用m个peg转移某个中间peg,再把下面的n-k个disc利用m-1个peg转移到目标peg,最后把上面的k个disc利用m个peg移到目标peg。dp过程记下使得f[n][m]最小的g[n][m]=k用于
转载 2013-04-05 20:49:00
28阅读
不太理解#include #include #include #include #include #include #include #include #include #include #include const int inf = 0x3f3f3f3f;//1061109567typedef long long ll;const int maxn = 40000
原创 2022-08-04 14:04:44
59阅读
https://cn.vjudge.net/problem/ZOJ-3613题意:n 个星球,每个星球 p 个工厂,s 个资源,给出 m 条路及其代价,一个医院只能对应一个工厂,求出可以获得资源的最多工厂数及其对应的最低代价。分析:几乎是裸题了。有几个注意点:如果一个星球既有资源又有工厂,那么不需要建路,直接就可以用,但是用了以后这个星球的资源就没了,被占用了。最后枚举状态...
原创 2022-12-07 00:19:10
59阅读
ZOJ Problem Set - 1244Definite ValuesTime Limit: 2 Seconds Memory Limit: 65536 KBA common error in programming is to use variables that have not been initialized before. For example, in C and C++, all variables have an indefinite value after declaration - their value can be anything. Thus, the fo...
原创 2021-07-29 16:21:40
64阅读
分析: 组合数学类型的题目。 正常的话可能会去分解1~N数里面有几个5和2,但是这样的复杂度为O(nlogn)。 其实有更巧妙的办法,可以把问题分解成子问题。 可以发现N!末尾的0与1~N中有几个5的因子相同(因为2总是比5多)。 1~N中只有5的倍数包含5因子,比如[5, 10, 15, 20.....
转载 2017-09-27 21:06:00
122阅读
#include #include using namespace std;int n,m,s2,e2;int b[205][205],d[4][2]={{1,0},{-1,0},{0,1},{0,-1}};char a[205][205];struct point{ int x,y,step;}p;queue q;int bfs(point pp){ int i,j,k; point t; q.push(pp); while(!q.empty()) { p=q.front(),q.pop(); for(i=0;i=0&&j=0&&k>n>>m Read More
转载 2013-08-07 19:30:00
108阅读
2评论
#include#include//进位问题如3.985 应该进位3.99int main() { int n,k,i;double w,s;char str[30];while(scanf("%d%lf%d",&n,&w,&k)!=EOF) { i=(n+2)/k; n=n+2-i; s=...
转载 2014-03-12 14:51:00
67阅读
2评论
超级神奇有趣题。AC自动机+数位DP。其实,数位DP在处理含有某些数字时特别不好处理,应该把它倒转为求不含有。这道题把数位DP+AC自动机结合起来,实在是很巧妙,把数字变为串来处理,强大!要使用AC自动机来处理数位DP,首先就是要确定哪些状态由当前状态开始是不可以到达的,有哪些是可以到达的。这是显而...
转载 2015-03-14 21:23:00
44阅读
2评论
方程很明显有d[i]=sum(pk*d[i+k])+p0*d[0];其中pi可以在开始时枚举求出。设d[i]=A[i]*d[0]+B[i],代入上式d[i]=(sum(pk*A[i+k])+p0)+sum(pk*B[i+k])+1可得A[i]=sum(pk*A[i+k])+p0B[i]=sum(pk...
转载 2014-11-19 10:28:00
88阅读
2评论
最小圆覆盖#include #include #include #include using namespace std;const double eps=0.00000001;struct point { double x,y;}p[110];struct circle{ point cent; ...
1 /* 2 ZOJ 3213 3 4 好吧,看过那种括号表示法后,就崩溃了,实在受不了。情况复杂,写了两天,人也有点傻X了,只能放弃,转而用最小表示法。 5 最小表示法不难写: 6 7 1)首先,要承认路径上有格子不选的情况,于是,在00的情况下,可扩展,也可不选。 8 ...
转载 2014-05-28 22:41:00
55阅读
2评论
#include #include #include #include #include #include using namespace std; #define ll long long const int N =1e5+9; int t,n,a[N]; int b[50]; /* 要想两个数的异或结果比两者都大 必须两数的首位都为1,其他位...
转载 2018-09-18 09:32:00
40阅读
2评论
#define ll long long const int N =1e5+9; int t; ll ans,tmp; char s[N]; int main() { scanf("%d",&t); while(t--) { scanf("%s",s); int l=strlen(s)...
转载 2018-09-18 00:27:00
58阅读
2评论
最小区间覆盖,排序加上贪心。  #include <iostream> #include <algorithm> #include <cstdio> using namespace std; struct SetNode{ int a; int b; }mySet[5010]; int n; int minPoint; int maxPoint;
转载 2009-09-06 00:14:00
34阅读
2评论
  • 1
  • 2
  • 3
  • 4
  • 5