2721: [Violet 5]樱花】的更多相关文章

2721: [Violet 5]樱花 Time Limit: 5 Sec  Memory Limit: 128 MBSubmit: 599  Solved: 354 Description Input Output Sample Input Sample Output HINT Source interviewstreet--EQUATIONS [分析] 之前推出来然后几天直接打然后把$n!^2$的约数记成$n^2$的约数也是醉.. 先通分. 则$(x+y)*n!=x*y$ 设$g=gcd(x,…
2721: [Violet 5]樱花 Time Limit: 5 Sec  Memory Limit: 128 MBSubmit: 547  Solved: 322[Submit][Status][Discuss] Description Input Output Sample Input   Sample Output   HINT Source interviewstreet--EQUATIONS 分析: 考虑$y$大于$n!$,但是要求个数,所以不可能无限大,所以我们需要寻找的就是上界,考…
[Violet 5]樱花 Time Limit: 5 Sec  Memory Limit: 128 MBSubmit: 671  Solved: 395[Submit][Status][Discuss] Description Input Output Sample Input   Sample Output   HINT 题解: 上面废话许多. 设n!=z,y=z+d 1/x+1/y=1/z 1/x+1/(z+d)=1/z (x+z+d)/(x*z+dx)=1/z z(x+z+d)=x*z+d…
题目链接:BZOJ - 2721 题目分析 题目大意:求出 1 / x + 1 / y = 1 / n! 的正整数解 (x, y) 的个数. 显然,要求出正整数解 (x, y) 的个数,只要求出使 y 为正整数的正整数 x 的个数,或者求出使 x 为正整数的正整数 y 的个数即可. 那么我们来转化一下这个式子: 通分: (x + y) / xy = 1 / n! n!(x + y) = xy 将 y 分离出来: n!x = xy - n!y n!x = (x - n!)y y = n!x / (…
先跪一发题目背景QAQ 显然x,y>n!,然后能够设y=n!+d 原式子能够化简成 x=n!2d+n! 那么解的个数也就是n!的因子个数,然后线性筛随便搞一搞 #include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include<queue> #include<vector> #include<set> #include<ma…
(X-N)(Y-N)=N^2 #include<cstdio> using namespace std; const int mod=1e9+7; int n,cnt,isprime[1000005],prime[1000005]; void Pre_prime(){ for (int i=2; i<=n; i++){ if (!isprime[i]) prime[++cnt]=i; for (int j=1; j<=cnt && i*prime[j]<=n;…
BZOJ_2721_[Violet 5]樱花_数学 Description Input Output $\frac{1}{x}+\frac{1}{y}=\frac{1}{m}$ $xm+ym=xy$ $(x-m)*(y-m)=m^{2}$ 于是转化为了求$n!$的约数个数 可以用每个质因子搞一下 代码: #include <stdio.h> #include <string.h> #include <algorithm> #include <stdlib.h>…
[BZOJ2721][Violet 5]樱花 Description Input Output Sample Input 2 Sample Output 3 HINT 题解:,所以就是求(n!)2的约数个数 又有一个结论,若n=Πpi^ei,那么n的约数个数就是Π(ei+1),所以我们只需要筛出1-n 的所有素数,再分别计算每个素数的贡献就行了. #include <cstdio> #include <cstring> #include <iostream> #defi…
先令n! = a: 1 / x + 1 / y = 1 / a  =>  x = y * a / (y - a) 再令 k = y - a: 于是x = a + a ^ 2 / k  =>  k | a ^ 2 故等价于求a ^2的约数个数 素数筛一下什么的就好了嘛 /************************************************************** Problem: 2721 User: rausen Language: C++ Result: Ac…
题目传送门:https://www.lydsy.com/JudgeOnline/problem.php?id=2721 好久没做数学题了,感觉有些思想僵化,走火入魔了. 这道题就是求方程$ \frac{1}{x}+\frac{1}{y}=\frac{1}{n!} $的正整数解个数. 首先我们可以把方程化为$ (x+y)n!=xy $...然后就发现搞不出什么了. 但是我们可以考虑换元,因为显然$ x,y>n $,所以我们设$ y=n!+k $,然后我们就可以把方程化为$ (x+n!+k)n!=x…