BestCoder Round #1 第二题 项目管理

摘要: // 第二题 我记得很久很久很久以前看过这样的题目,忘记是哪的区域赛了// 记得有人说和节点度数有关,我记不清了,反正当时完全不懂// 然后我想了想,估计就是更新节点度数有关,YY出来可能只要更新相邻节点度数更大或更小的就可以了// 复杂度不知道多少,就是提交了试试,15MS就过了// 看来就是这样... 阅读全文
posted @ 2014-07-20 20:12 江财小子 阅读(278) 评论(0) 推荐(0) 编辑

BestCoder Round #1 第一题 逃生

摘要: // 等了好久,BESTCODER 终于出来了、、像咋这样的毕业的人、、就是去凑凑热闹// 弱校搞acm真是难,不过还是怪自己不够努力// 第一题是明显的拓扑排序,加了了个字典序限制而已// 用优先队列就可以搞定了#include #include #include #include #includ... 阅读全文
posted @ 2014-07-20 20:02 江财小子 阅读(681) 评论(2) 推荐(0) 编辑

携程 决赛 第一题 Crossword

摘要: //真是郁闷的一晚上//比赛时看到这题是就感觉会做,感觉思路清晰 就去准备找第二题 ,因为感觉第二题是个经典问题,(我不会计算几何),就去搜索了下,然后找到求最小面积的,改来改去,一直Wa// 然后就只剩下一个小时了 ,我决定放弃它,去写第一题 就是这题,然后整栋楼离奇断网什么的、、还调试了好久、、... 阅读全文
posted @ 2014-04-14 23:14 江财小子 阅读(305) 评论(2) 推荐(0) 编辑

POJ 1286 Necklace of Beads

摘要: // 3中颜色的n个珠子 问有多少种不同数量 旋转和翻转后相同算一种 // 先考虑旋转 转i格 循环节 gcd(i,n)// 翻转的话 n为奇数 每种翻转循环节 n/2+1// n为偶数 n/2的循环节为 n/2 n/2的循环节为 (n-2)/2 +2// 最后用 polya定理#include #include using namespace std;#define LL long longLL Pow(LL a,LL b){ LL t=1; for(;b;b>>=1) { if(b&1) t=t*a; a=a*a; } retur... 阅读全文
posted @ 2014-03-30 12:06 江财小子 阅读(148) 评论(0) 推荐(0) 编辑

POJ 2154 Color

摘要: // polyya定理 题意就是n种颜色n个球 求不同染色方案 "不考虑翻转"//首先 n^gcd(n,i) i=0~n-1// n太大 求 k=gcd(n,i)的个数 枚举q|n 1~sqrt(n) 再求phi(n/q) phi(q)// #include #include using namespace std;int Pow(int a,int b,int m){ int t; a=a%m; for(t=1;b;b>>=1) { if(b&1) t=(t*a)%m; a=(a*a)%m; } return t;}int p... 阅读全文
posted @ 2014-03-28 17:07 江财小子 阅读(215) 评论(0) 推荐(0) 编辑

hdu 2461 Rectangles

摘要: 求矩形的并 矩形个数 1...20m次询问 回答要求的r个矩形的并容斥原理dfs优化: 遇到面积交为0时 这个dfs分支可以不下去了#include #include #include#include #include #include #include #include using namespace std;//#define LL long long#define LL __int64struct Rectan{ int x1,y1; int x2,y2; Rectan jiao(Rectan &R) { Rectan t; t.x1... 阅读全文
posted @ 2014-03-25 17:22 江财小子 阅读(153) 评论(0) 推荐(0) 编辑

Scoi 2010 幸运数字

摘要: 【题目描述】在中国,很多人都把6和8视为是幸运数字!lxhgww也这样认为,于是他定义自己的“幸运号码”是十进制表示中只包含数字6和8的那些号码,比如68,666,888都是“幸运号码”!但是这种“幸运号码”总是太少了,比如在[1,100]的区间内就只有6个(6,8,66,68,86,88),于是他又定义了一种“近似幸运号码”。lxhgww规定,凡是“幸运号码”的倍数都是“近似幸运号码”,当然,任何的“幸运号码”也都是“近似幸运号码”,比如12,16,666都是“近似幸运号码”。现在lxhgww想知道在一段闭区间[a, b]内,“近似幸运号码”的个数。【输入】输入数据是一行,包括2个数字a和b 阅读全文
posted @ 2014-03-25 17:00 江财小子 阅读(422) 评论(0) 推荐(0) 编辑

poj 1426 Find The Multiple

摘要: //给你一个整数 1#include #include #include #include #include #include #include using namespace std;#define LL __int64//#define LL long long#define N 1010struct node{ int num; int fa; int lf;}No[N];int h[210];void output(int id){ if(id) { output(No[id].fa); printf("%d",No[id].n... 阅读全文
posted @ 2014-03-23 22:27 江财小子 阅读(145) 评论(0) 推荐(0) 编辑

hdu 1695 GCD

摘要: // 题意: 给你区间[a,b] [c,d] 在两个区间各取一个数x,y,要求gcd(x,y)= k// 题目给的区间中说 0 #include #include#include #include #include #include #include using namespace std;#define LL __int64//#define LL long long#define N 100010struct node{ int cnt; int pr[10];}hs[N];LL phi[N];LL ans;void init(){ int i,j; for(i... 阅读全文
posted @ 2014-03-23 21:42 江财小子 阅读(148) 评论(0) 推荐(0) 编辑

poj 3370 Halloween treats

摘要: //poj 3370 c个小孩 n户人家 n>=c 每个人家有一些糖果,找些人家糖果和是c的倍数 输出找到人家的编号 (从1开始计算)//鸽巢原理// n个数必定存在某段连续和是n的倍数// 累加求余可以看出这个#include #include #include using namespace std;#define LL __int64LL a[100010];int h[100010];int main(){ int c,n; while(scanf("%d%d",&c,&n),c|n) { // printf("%lld\n" 阅读全文
posted @ 2014-03-23 20:43 江财小子 阅读(131) 评论(0) 推荐(0) 编辑