上一页 1 2 3 4 5 6 ··· 18 下一页
摘要: 题目链接:http://acm.buaa.edu.cn/problem/59/想法:由于要有最少的扇形来覆盖所有的点,点有哪么多,肯定是贪心算法,想到一个在一条直线上的很多点,要用最少区间去覆盖所有点,这个是贪心,只需要从最左边第一个点开始覆盖即可。 但这个题是平面上的,如何贪心? 这里想到由于必要有个扇形覆盖的起点,不可能每个都枚举,那个更可能?? 我的想法是:找到任意两个点间最大的间隔角度,起点从其中一个开始,就转换成直线上区间覆盖点的问题了。代码:#include#include#include#include#includeusing namespace std;const doub. 阅读全文
posted @ 2013-12-06 21:30 等待最好的两个人 阅读(274) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.buaa.edu.cn/problem/418/代码:#include#include#include#includeusing namespace std;const int maxn = 550;const int maxe = 5050;const int INF = 0x3f3f3f3f;int pa[maxn];int find(int x){ return x == pa[x] ? x : pa[x] = find(pa[x]);}struct Edge{ int u,v,w; bool operator rhs.w; }}... 阅读全文
posted @ 2013-12-06 19:54 等待最好的两个人 阅读(134) 评论(0) 推荐(0) 编辑
摘要: void get_div() //筛因子{ for(int i=2; i<maxn; i++) for(int j=i; j<maxn; j+=i) dx[j].push_back(i);}View Code 阅读全文
posted @ 2013-11-17 21:06 等待最好的两个人 阅读(296) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://codeforces.com/problemset/problem/264/B代码:#include#include#include#includeusing namespace std;const int maxn = 105000;int dp[maxn];vector dx[maxn];void get_div() //筛因子{ for(int i=2; i>n) { memset(dp,0,sizeof(dp)); for(int i=1; i>a; int Max = 1; ... 阅读全文
posted @ 2013-11-17 21:05 等待最好的两个人 阅读(204) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3549最核心的是由于m^n 太大, 存不下了,存下来的复杂度也太高,就只能边运算边取模,看别人的代码才想到。0s 不会很多,就暴力枚举。import java.math.*;import java.util.*;public class Main { static BigInteger Fast_Power(BigInteger x ,BigInteger n, BigInteger mod) { BigInteger ret = Bi... 阅读全文
posted @ 2013-11-16 09:28 等待最好的两个人 阅读(291) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://codeforces.com/contest/294/problem/C代码:import java.util.*;import java.math.*;public class Main { public static void main(String[] args){ Scanner cin = new Scanner(System.in); BigInteger[] fir; fir = new BigInteger[1050]; fir[0] = fir[0].ONE; for(int ... 阅读全文
posted @ 2013-11-01 16:48 等待最好的两个人 阅读(191) 评论(0) 推荐(0) 编辑
摘要: import java.io.*; import java.math.BigInteger; import java.util.*; public class Main { public static void main(String[] args) { BigInteger ans,Zero; Zero = BigInteger.ZERO; ans = BigInteger.ZERO; Scanner cin = new Scanner(System.in); while(cin.hasNextBig... 阅读全文
posted @ 2013-10-31 20:17 等待最好的两个人 阅读(188) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://codeforces.com/contest/358/problem/D#include#include#include#includeusing namespace std;const int maxn = 3005;int a[maxn],b[maxn],c[maxn];int dp1[maxn],dp2[maxn];int n;int main(){ //freopen("E:\\acm\\input.txt","r",stdin); cin>>n; for(int i=1; i>a[i]; for(int 阅读全文
posted @ 2013-10-31 17:04 等待最好的两个人 阅读(205) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4122代码:#include#include#include#include#include#includeusing namespace std;const int maxn = 100500;struct Node{ int id,val;};int order[2555];long long R[2555];int S,T,N,M;struct Myqueue{ Node Q[maxn]; int head,tail; void init() { h... 阅读全文
posted @ 2013-10-24 22:40 等待最好的两个人 阅读(171) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://poj.org/problem?id=2503代码:#include#include#include#includeusing namespace std;const int maxn = 100050;const int HASH = 1000003;int head[HASH],next[maxn];char s1[maxn][15],s2[maxn][15];int n;int hash(char *s){ int ret = 0; int seed = 131; while(*s) { ret = ret * seed + ... 阅读全文
posted @ 2013-10-11 18:48 等待最好的两个人 阅读(236) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 18 下一页