- 博客(13)
- 问答 (1)
- 收藏
- 关注
原创 51NOD 1806 wangyurzee的树(容斥原理 + 组合数学)
传送门 wangyurzee有n个各不相同的节点,编号从1到n。wangyurzee想在它们之间连n-1条边,从而使它们成为一棵树。 可是wangyurzee发现方案数太多了,于是他又给出了m个限制条件,其中第i个限制条件限制了编号为u[i]的节点的度数不能为d[i]。 一个节点的度数,就是指和该节点相关联的边的条数。 这样一来,方案数就减少了,问题也就变得容易了,现在请你告诉wangyur
2017-06-29 17:46:05 877 7
原创 求 [1,n-1]中 与 n 的 GCD 值的和
如何求 ∑n−1i=1gcd(i,n)——(1)\sum_{i=1}^{n-1}gcd(i, n)——(1) 因为 gcd(i,n)gcd(i,n) 的值一定是 nn 的因子,然后我们通过观察发现 (1)(1) 式可以写成如下形式: ∑d∗phi(nd),d∈{n的因子},去掉d是n的情况\sum d*phi(\frac n d),d\in \{n的因子\},去掉d是n的情况,其中phi(i):
2017-06-27 18:14:31 748
原创 HDU 5514 Collision(扩展欧几里得+解方程)——2014ACM/ICPC亚洲区北京站
传送门 Matt is playing a naive computer game with his deeply loved pure girl. The playground is a rectangle with walls around. Two balls are put in different positions inside the rectangle. The bal
2017-06-26 18:45:09 703
原创 HDU - 5120 Intersection(简单几何)——2014ACM/ICPC亚洲区北京站
传送门 Matt is a big fan of logo design. Recently he falls in love with logo made up by rings. The following figures are some famous examples you may know. A ring is a 2-D figure bounded by two circl
2017-06-25 20:53:50 871
原创 HDU 5572 An Easy Physics Problem(计算几何)——2015ACM/ICPC亚洲区上海站-重现赛
传送门 An Easy Physics ProblemTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 2322 Accepted Submission(s): 469Problem Description On an infinite
2017-06-18 20:01:46 1251
原创 Poj 2689 Prime Distance(素数筛+二次素数筛)
传送门The branch of mathematics called number theory is about properties of numbers. One of the areas that has captured the interest of number theoreticians for thousands of years is the question of prima
2017-06-16 11:57:27 499
原创 NTT(快速数论变换)模板
例题: HDU 1402#include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>#include <cmath>using namespace std;const double PI = acos(-1.0);typedef long long LL;const LL MAXN = (1LL<<1
2017-06-14 12:53:39 878
原创 HDU 5514 Frogs(欧拉函数+数论YY)
传送门 FrogsTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 2198Accepted Submission(s): 714Problem Description There are mm stones lying on a c
2017-06-12 12:37:20 3324 7
原创 51NOD 1678 lyk与gcd(容斥+素数筛)
传送门 这天,lyk又和gcd杠上了。 它拥有一个n个数的数列,它想实现两种操作。1:将 aia_i 改为 bb。 2:给定一个数i,求所有 gcd(i,j)=1gcd(i,j)=1 时的 aja_j 的总和。Input 第一行两个数n,Q(1<=n,Q<=100000)。 接下来一行n个数表示ai(1<=ai<=10^4)。 接下来Q行,每行先读入一个数A(1<=A<=2)。
2017-06-11 21:13:48 814
原创 51NOD 1341 混合序列(构造矩阵)
传送门 题目描述: Input共1行,4个整数数p, q, r, n中间用空格分隔(1 <= p, q, r, n<=1000000000)。Output对于每一个数据,在一行中输出答案。Input示例2 2 1 1Output示例3解题思路:令 f(n)=∑ni=0ai∗bn−if(n)=\sum_{i=0}^na_i*b_{n-i},将其展开有: f(n)=a0∗bn+a1∗bn−1+..
2017-06-07 10:55:06 758
原创 计蒜客47——圈果树(二维凸包)
传送门 小马承包了一个果园,想修一个围栏,但是不希望砍掉任何的果树。对于给出的所有的果树的坐标,计算一下最小的围住所有的果树的围栏的长度。输入数据的第一行包括一个整数 N(0≤ N ≤10,000)表示农夫约翰想要围住的放牧点的数目。接下来 N 行,每行由两个由空格分隔的实数组成,Xi 和 Yi,对应平面上的放牧点坐标(-1,000,000 ≤
2017-06-06 19:11:31 621
原创 HDU 5953 Game of Taking Stones(威佐夫博弈+高精度+二分)——The 2016 ACM-ICPC Asia Dalian Regional Contest
传送门 Two people face two piles of stones and make a game. They take turns to take stones. As game rules, there are two different methods of taking stones: One scheme is that you can take any number of
2017-06-04 15:50:26 1705
原创 HDU 4572 Bottles Arrangement(数学推公式)——2013 ACM-ICPC长沙赛区全国邀请赛
传送门 Bottles ArrangementTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 746 Accepted Submission(s): 565Problem Description Hunan cuisine is
2017-06-02 21:11:26 1042
空空如也
为什么POJ中有很多题目,用G++就WA,用C++就是AC的
2016-06-19
TA创建的收藏夹 TA关注的收藏夹
TA关注的人