POJ 2318 TOYS
题目大意:
第一行n,m,x1,x2,y1,y2,表示有个玩具收纳盒被n个线段分为n+1块,编号依次是0,1,2....n,这个收纳盒的左上角坐标是x1,y1,右下角是x2,y2,接下来n行u0,l0,是指给你这些线段的坐标,(u0,y1)与(l0,y2) ,紧接着是m行,表示玩具的坐标,问你每一块玩具的个数
解题思路:
利用二分求出玩具所在哪一块,因为在左边或者在右边,满足单调性,利用叉积算出在左边还是右边。
解题代码:见文章...
分类:
其他好文 时间:
2014-05-23 07:51:28
阅读次数:
322
Sunscreen
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 3317
Accepted: 1171
Description
To avoid unsightly burns while tanning, each of the C (1 ≤ C ≤ 25...
分类:
其他好文 时间:
2014-05-22 12:10:39
阅读次数:
261
首先分成一半2^17和2^18,并且把其中一半变成相反数,然后枚举一半二分查找另一半,在找到的位置前后也找找。
这里用到了二级排序,有很多细节要处理,不多说了。
巨坑的一个地方就是,不能用系统的abs,要自己手写,简直坑死。。
#include
#include
#include
#include
using namespace std;
typedef long long ...
分类:
其他好文 时间:
2014-05-22 12:01:31
阅读次数:
220
知识点:
最小公倍数(a,b)=a*b/最大公约数(a,b)
Party
Description
The CEO of ACM (Association of Cryptographic Mavericks) organization has...
分类:
其他好文 时间:
2014-05-22 11:41:33
阅读次数:
354
Sol:就是求第N项的斐波那契数。矩阵乘法+快速幂
#include
#include
#include
#include
using namespace std;
#define LL long long
struct Mat{
LL f[2][2];
};
LL MOD = 10000;
Mat mul(Mat a,Mat b)
{
LL i,j,k...
分类:
其他好文 时间:
2014-05-22 10:46:35
阅读次数:
191
题目大意:
给定一个区间范围[M,E],接下来有n行输入,每行输入三个数值:T1,T2,S,表示覆盖区间[T1,T2]
的代价为S,要求你求出覆盖区间[M,E]的最小代价,如果不能覆盖,则输出-1.
解题思路:
先将区间按右端点进行排序,这样我们就能得到dp状态的定义和转移方程:
dp[i...
分类:
其他好文 时间:
2014-05-22 10:22:51
阅读次数:
309
Primes
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 3204
Accepted: 1245
Description
A pretty straight forward task, calculate the number of primes b...
分类:
其他好文 时间:
2014-05-22 09:02:28
阅读次数:
517
题目链接:poj 2411 Mondriaan's Dream
题目大意:用1?2的木块填满n?m的矩阵有多少种方法。
解题思路:插头dp裸题。uva11270
#include
#include
typedef long long ll;
const int N = 13;
int n, m;
ll set, dp[N+5][(15];
void solve (int d,...
分类:
其他好文 时间:
2014-05-22 08:06:07
阅读次数:
177
Red and Black
Time Limit: 1000MS
Memory Limit: 30000K
Total Submissions: 21482
Accepted: 11488
Description
There is a rectangular room, covered with square tiles. Eac...
分类:
其他好文 时间:
2014-05-22 07:09:25
阅读次数:
237
ExpeditionTime Limit: 1000MSMemory Limit: 65536KDescriptionA group of cows grabbed a truck and ventured on an expedition deep into the jungle. Being rather poor drivers, the cows unfortunately manag...
分类:
其他好文 时间:
2014-05-22 06:16:01
阅读次数:
423