上一页 1 2 3 4 5 6 7 8 ··· 18 下一页
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4474(a*10+b)%c = ((a%c)*10+b%c)%c;然后从高位开始枚举能填的数字填充,只是注意最高位(第一位)不能为0。代码:#include#include#include#include#include#includeusing namespace std;struct Node{ string s; int mod; Node(string s="",int mod=0): s(s),mod(mod) {}};bool can[15];bool vis[100 阅读全文
posted @ 2013-10-05 18:57 等待最好的两个人 阅读(194) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://codeforces.com/problemset/problem/348/A代码:#include#include#include#includeusing namespace std;int main(){ //freopen("E:\\acm\\input.txt","r",stdin); int n; scanf("%d",&n); long long L,R; L = R = 0; for(int i=1; i<=n; i++) { long long a; scanf("%I 阅读全文
posted @ 2013-10-03 12:56 等待最好的两个人 阅读(186) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4750代码:#include#include#include#includeusing namespace std;const int maxn = 10005;const int maxm = 500500;struct Edge{ int u,v,w; Edge(int u=0,int v=0,int w=0): u(u), v(v), w(w) {} bool operator >n>>m) { for(int i=0; i<n; i++) ... 阅读全文
posted @ 2013-10-01 22:45 等待最好的两个人 阅读(172) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=4882代码:#include#include#include#include#includeusing namespace std;const int maxn = 200005;struct Edge{ int u,v,w; Edge(int u=0,int v=0,int w=0): u(u), v(v), w(w) {} bool operator rhs.w; }}edges[maxn];int counts[maxn];int p... 阅读全文
posted @ 2013-10-01 20:37 等待最好的两个人 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=4879代码:#include#include#include#include#includeusing namespace std;const int maxn = 550;struct Two_Sat{ int n; vector G[maxn*2]; bool mark[maxn*2]; int s[maxn*2],cnt; void init(int n) { this->n = n; memse... 阅读全文
posted @ 2013-10-01 12:06 等待最好的两个人 阅读(180) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://poj.org/problem?id=3678代码:#include#include#include#include#includeusing namespace std;const int maxn = 1050;struct Two_Sat{ int n; vector G[maxn*2]; bool mark[maxn*2]; int s[maxn*2],cnt; void init(int n) { this->n = n; memset(mark,0,sizeof(mark)); f... 阅读全文
posted @ 2013-10-01 10:42 等待最好的两个人 阅读(177) 评论(0) 推荐(0) 编辑
摘要: 代码:#include#include#include#includeusing namespace std;const int maxn = 100000 + 100;const int maxlog = 20;int a[maxn],num[maxn],Left[maxn],Right[maxn];int counts[maxn];int n,q;int segcnt;struct RMQ{ int d[maxn][maxlog]; void init() { memset(d,-0x3f,sizeof(d)); for(int i=1; i>... 阅读全文
posted @ 2013-09-30 22:01 等待最好的两个人 阅读(174) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4768算法思路:最核心的就是找到前n个人的传单数总和可以二分。代码:#include#include#include#includeusing namespace std;const int maxn = 20002;long long A[maxn],B[maxn],C[maxn];int N;int main(){ //freopen("E:\\acm\\input.txt","r",stdin); while(cin>>N) { long l 阅读全文
posted @ 2013-09-29 23:20 等待最好的两个人 阅读(151) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4762题目大意:一个圆形蛋糕,现在要分成M个相同的扇形,有n个草莓,求n个草莓都在同一个扇形上的概率。算法思路:n个草莓在圆形上有一个最左边的,为了好理解,先把假设草莓有1-n的不同编号。 现在从n个草莓中选出一个编号A的放在最左边(这个最左边可以随便放),得到C(n,1)*1.然后把其余的n-1草莓不分先后的放在A的右边角大小为(360)/m的扇形区域内就可以了。 所以概率为 n/(m^(n-1));由于20^20超 long long了,所以要用高精度。而且要约分。代码:#include#inc 阅读全文
posted @ 2013-09-28 21:51 等待最好的两个人 阅读(403) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.timus.ru/problem.aspx?space=1&num=1046参考博客:http://hi.baidu.com/cloudygoose/item/21fee021a5db348d9d63d17b参考资料(向量的旋转):http://www.cnblogs.com/woodfish1988/archive/2007/09/10/888439.html题目大意:就是已知n个点,n个角。点Mi可以与多边形Ai和Ai+1构成等腰三角形,顶角为ang[i]. 现在要你求出这个多边形的n的顶点。算法思路:刚开始想几何性质,怎么也想不出来一个好的思路。没 阅读全文
posted @ 2013-09-24 22:42 等待最好的两个人 阅读(565) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 18 下一页