hdu 4779 Tower Defense 2013杭州现场赛】的更多相关文章

/** 题意: 有两种塔,重塔,轻塔.每种塔,能攻击他所在的一行和他所在的一列, 轻塔不 能被攻击,而重塔可以被至多一个塔攻击,也就是说重塔只能被重塔攻击.在一个n*m 的矩阵中,最少放一个塔,可放多个 问,给定p个重塔,q个轻塔,问有多少种放法.. 思路: 1. 一行中有两个重塔, 2. 一列中有两个重塔 3. 在该行及在该行塔所在的列只有一个塔,重塔或者轻塔. 对以上三种情况 挨个处理: 1. 设有i行有两个重塔,j列有两个重塔,则一共占 i+2*j 行, j+2*i列,共用2*(i+j)个…
杭州现场赛的题.BFS+DFS #include <iostream> #include<cstdio> #include<cstring> #define inf 9999999 using namespace std; char mp[105][105]; int sq[5][5]; int step[4][2]={{0,1},{1,0},{0,-1},{-1,0}}; struct pos { int x,y; }; int n,m,prn,x,y,tmp,ans…
Mex Time Limit: 15000/5000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 623    Accepted Submission(s): 209 Problem Description Mex is a function on a set of integers, which is universally used for impartial game t…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4816 2013长春区域赛的D题. 很简单的几何题,就是给了一条折线. 然后一个矩形窗去截取一部分,求最大面积. 现场跪在这题,最后时刻TLE到死,用的每一小段去三分,时间复杂度是O(n log n) , 感觉数据也不至于超时. 卧槽!!!!代码拷回来,今天在HDU一交,一模一样的代码AC了,加输入外挂6s多,不加也8s多,都可AC,呵呵·····(估计HDU时限放宽了!!!) 现场赛卡三分太SXBK…
Tower Defense Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 132768/132768 K (Java/Others) Total Submission(s): 474    Accepted Submission(s): 126 Problem Description DRD loves playing computer games, especially Tower Defense games. Tower De…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4821 字符串题. 现场使用字符串HASH乱搞的. 枚举开头! #include <stdio.h> #include <string.h> #include <iostream> #include <algorithm> #include <queue> #include <map> #include <set> #inclu…
比赛的时候就预感到这题能出,但是会耗时比较多.结果最后是出了,但是有更简单的题没出. 是不是错误的决策呢?谁知道呢 题目意思: 定义f(x) = x分解质因数出来的因子个数 如 x = p0 * p0 * p0 * p1 * p2,则f(x) = 5 特殊的, f(1) = 0 求 i = [1..n], j = [1..m] 组成的n*m组(i, j)对中,有多少组f( gcd(i,j) ) <= p 考虑简化版本,p = 0,即求有多少组 gcd(i,j) == 1. 见HDU 1695 h…
Two Rabbits Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 505    Accepted Submission(s): 260 Problem Description Long long ago, there lived two rabbits Tom and Jerry in the forest. On a sunny…
Save Labman No.004 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 624    Accepted Submission(s): 154 Problem Description Due to the preeminent research conducted by Dr. Kyouma, human beings hav…
Zhuge Liang's Mines Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 239    Accepted Submission(s): 110 Problem Description In the ancient three kingdom period, Zhuge Liang was the most famous an…