题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1011题目大意:在一棵树上,给你起始状态,问你能否到达终止状态。给了树的前序遍历序。直接dfs搜索。 1 #include 2 #include 3 #in...
分类:
其他好文 时间:
2014-11-19 18:17:29
阅读次数:
267
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1010题目大意:给你n个点,问你顺次连线能否连成多边形?如果能,就输出多边形面积。面积用向量的叉积去算。然后能否连成多边形就是看这条线跟之前的线有没有交点。这些在大白...
分类:
其他好文 时间:
2014-11-19 17:46:34
阅读次数:
152
方程很明显有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 12:09:48
阅读次数:
223
题意 如果一个正整数y满足 将任意正整数x放到y的左边得到的数z满足 z%y==0 那么这个数就是个Magic Number 给你一个范围 求这个范围内Magic Number的个数
令 l表示y的位数 ly=10^l 那么z=x*ly + y 要z%y==0 容易看出 只需 x*ly%y==0
又因为x是任意的 所以一个Magic Number必须满足 ly%y...
分类:
其他好文 时间:
2014-11-18 15:56:45
阅读次数:
202
Most PowerfulTime Limit: 2 Seconds Memory Limit: 65536 KBRecently, researchers on Mars have discovered N powerful atoms. All of them are different. Th...
分类:
其他好文 时间:
2014-11-18 01:34:47
阅读次数:
208
Food Delivery
Time Limit: 2 Seconds Memory Limit: 65536 KB
When we are focusing on solving problems, we usually prefer to stay in front of computers rather than go out for lunch. At thi...
分类:
其他好文 时间:
2014-11-17 22:57:23
阅读次数:
529
题目链接:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=660
TimeLimit: 3.000 seconds
A Sudoku grid is a 16 x 16 grid of cells grouped in sixteen...
分类:
其他好文 时间:
2014-11-17 21:18:14
阅读次数:
264
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1009题目大意:给你三个转换轮,只有当第一个转换轮转动一圈后第二个才会转,当第二个转动一圈后第三个才会转。转换轮的意思是我按动一个按钮,显示器经过转换轮的转换显示另外...
分类:
其他好文 时间:
2014-11-17 12:18:20
阅读次数:
203
题目链接:ZOJ 2706 Thermal Death of the Universe (线段树)
题意:n个数,m个操作。
每个操作(a,b)表示(a,b)所有值更新为这个区间的平均数:1.当前的数列总和小于等于原数列总和,取平均值的上界,反之,取下界。
注意有负数的情况。
AC代码:
#include
#include
#define LL long long
#d...
分类:
其他好文 时间:
2014-11-17 10:51:10
阅读次数:
233
题目链接:ZOJ 2711 Regular Words (三维Catalan数)
题意:给出一串3*n长度的字符,其中是含有A,B,C,满足以下条件的字符串有多少种。
1.字符串中A,B,C的个数相同。
2.该字符串的前缀中 A,B,C的个数成非递减。
做法一:一个三维的Catalan数。
做法二:三维的DP。
AC代码:
import java.math...
分类:
其他好文 时间:
2014-11-17 10:50:03
阅读次数:
268