明显,当(X,Y)=1时,是可以看见的。这题,记得POJ 上也有类似的一题。。。不过比较奇怪的是,我以为会超时,因为范围达到了100000,但竟然直接枚举没超时。。。。#include #include #include #include #define LL __int64#define N 10...
分类:
其他好文 时间:
2014-10-02 18:06:23
阅读次数:
133
容斥原理简单应用#include #include #include #include #define LL __int64#define Np 100000using namespace std;bool isprime[Np];LL prime[Np],np;LL fac[100],fp;voi...
分类:
其他好文 时间:
2014-10-02 16:46:33
阅读次数:
157
In the next few sections, we’ll write two versions of a function called add_time, which calculates the sum of two Time objects. They demonstrate two k...
分类:
其他好文 时间:
2014-10-02 11:48:22
阅读次数:
116
题意:给你m个数(m#include #include #include #include #include using namespace std;#define ll long long#define maxn 110int t,m;int b[maxn];int p[1000+50];int ...
分类:
其他好文 时间:
2014-10-01 21:14:51
阅读次数:
186
As another example of a user-defined type, we’ll define a class called Time that records the time of day. The class definition looks like this: ...
分类:
其他好文 时间:
2014-10-01 19:47:11
阅读次数:
245
切割木板的顺序是自由的,所以每次选择两块最短的板,组合在一起,加入队列,原来两个板出队,直到队列中为空或者只剩下一个板时结束。这里使用优先队列较为方便。
#include
#include
#include
#include
#include
#define ll __int64
using namespace std;
int len[20005];
int main()
{
//...
分类:
其他好文 时间:
2014-10-01 18:42:41
阅读次数:
150
简单错排#include #include #include #define LL __int64using namespace std;LL Cnk[25][25];LL Dn[25];void initial(){ for(LL i=1;i<25;i++){ Cnk[i][0]=1; for.....
分类:
其他好文 时间:
2014-10-01 12:33:51
阅读次数:
163
http://acm.hdu.edu.cn/showproblem.php?pid=4811
因为看到ball[0]>=2 && ball[1]>=2 && ball[2]>=2 ans=(sum-6)*6+15 sum是三种颜色的球个数的和,然后就想到分类讨论,因为情况是可枚举的,
发现整数如果不加LL直接用%I64d打印会出问题
//#pragma comment(lin...
分类:
其他好文 时间:
2014-09-30 21:52:20
阅读次数:
192
FZU 2082 过路费
题目链接
树链抛分修改边的模板题
代码:
#include
#include
#include
using namespace std;
typedef long long ll;
const int N = 50005;
int dep[N], id[N], sz[N], top[N], son[N], fa[N], idx;
int ...
分类:
其他好文 时间:
2014-09-30 18:41:49
阅读次数:
212
Thee(你) I’ll chase(追逐;追捕) hence(因此;今后), thou(你;尔,汝) wolf in sheep’s array.—William Shakespeare, The First Part of Henry the SixthAn array is a linear(...
分类:
编程语言 时间:
2014-09-30 04:16:22
阅读次数:
269