Luogu P1445[Violet]樱花/P4167 [Violet]樱花
Luogu P1445[Violet]樱花/P4167 [Violet]樱花
真·双倍经验
化简原式:
$$\frac{1}{x}+\frac{1}{y}=\frac{1}{n!}$$
$$\frac{xy}{x+y}=n!$$
$$xy=n!(x+y)$$
$$-n!(x+y)+xy=0$$
$$(n!x+n!y)-xy=0$$
$$(n!)2+(n!x+n!y)-xy=(n!)2$$
$$(x-n!)(y-n!)=(n!)^2$$
所以$(x-n!)$就是$(n!)^2$的一个因子。
又因为$(x-n!)$的数量和$x$相等,那么解的个数就是$(n!)^2$的因数个数。
#include<bits/stdc++.h>
#define N 1000010
#define MOD 1000000007
using namespace std;
int n,cnt;
int pri[N];
long long ans=1;
bool vis[N];
void Read() {
scanf("%d",&n);
return;
}
void EulerSieve(int x) {
for(int i=2;i<=x;i++) {
if(!vis[i]) {
pri[++cnt]=i;
}
for(int j=1;j<=cnt;j++) {
if(i*pri[j]>x) {
break;
}
else {
vis[i*pri[j]]=1;
}
if(!(i%pri[j])) {
break;
}
}
}
return;
}
int Factor(int k,int p) {
if(k<p) {
return 0;
}
else {
return k/p+Factor(k/p,p);
}
}
void Solve() {
for(int i=1;i<=cnt;i++) {
ans*=Factor(n,pri[i])*2+1;
ans%=MOD;
}
printf("%lld",ans);
return;
}
int main()
{
Read();
EulerSieve(n);
Solve();
return 0;
}
Luogu P1445[Violet]樱花/P4167 [Violet]樱花的更多相关文章
- 【洛谷】P4167 [Violet]樱花
题面 又懒得弄题面,开个传送门吧 分析 人生第一次切数学题,我们先把方程写出来 $$\frac {1}{x}+\frac {1}{y}=\frac {1}{n!}$$ 现在我们知道的条件是x,y都是正 ...
- luogu P1445 [Violet]嘤F♂A
博主决定更博文啦 这道题一开始没什么思路啊qwq 要求 \(\frac{1}{x}+\frac{1}{y}=\frac{1}{n!}\) 的正整数解总数 首先通分,得 \[\frac{x+y}{xy} ...
- 让 Terminal/vim 使用 Solarized 配色
经过亲身体验,终于使用上了solarized的配色,之前配出来相差太多,于是找到这篇参考博文:http://blog.csdn.net/angle_birds/article/details/1169 ...
- 160908、前端开发框架Semantic UI
简介 网页开发中,CSS控制网页样式.作为测试开发工程师,我个人不太擅长手写CSS.样式微调.兼容浏览器等工作,所以我选择使用成熟的前端框架,可以快速开发出样式美观的网站,也解决了大部分浏览器兼容问题 ...
- 1352 - Colored Cubes (枚举方法)
There are several colored cubes. All of them are of the same size but they may be colored differentl ...
- POI--帮助文档
1.创建工作簿 (WORKBOOK) HSSFWorkbook wb = new HSSFWorkbook(); FileOutputStream fileOut = new FileOutputSt ...
- jQuery Dom对象操作 增、删、改、复制、包裹
1. 增(插入) 内部插入 //向每个匹配的元素内部追加内容,为最后一个子元素$('.violet').append('<div></div>'); //把所有匹配的元素追加到 ...
- POI3的资料整理
转自http://aman.cao.blog.163.com/blog/static/32951336201010823557408/ POI3的资料整理一.POI简介 Jakarta POI 是ap ...
- POJ2741 Colored Cubes
Description There are several colored cubes. All of them are of the same size but they may be colore ...
随机推荐
- anywhere随启随用的静态文件服务器
手机移动端调试,也可以使用anywhere anywhere -p 8080 指定端口 anywhere -s 保持浏览器关闭 anywhere -h localhost -p 8080 通过主机名 ...
- [Google] Help employee find the nearest gbike
You are given a campus map with the Google buildings, roads and Google bikes. You have to help the e ...
- 04点睛Spring4.1-资源调用
转发:https://www.iteye.com/blog/wiselyman-2210666 4.1 Resource spring用来调用外部资源数据的方式 支持调用文件或者是网址 在系统中调用p ...
- 切实解决socket连接掉线检测
原文:切实解决socket连接掉线检测 版权声明:欢迎转载,但是请保留出处说明 https://blog.csdn.net/lanwilliam/article/details/51698807 新公 ...
- SQL优化————Insert
1.如果是非生产环境,可以先将索引和约束删掉,等数据插入完之后,再建立索引和约束. 2.如果一次性插入数据较大,可以使用游标,每次小批量的插入数据. 3.如果数据表太大,可以构建历史表,老数据通常不会 ...
- ALT+J 多行编辑
很方便!!!
- [#] - .Net平台的实时性能监控
App Metricshttps://www.app-metrics.io ASP.NET Core之跨平台的实时性能监控http://www.cnblogs.com/GuZhenYin/p/7170 ...
- (一)构建基于ubuntu docker MySQL 5.6 镜像并推送到Docker Hub
一,创建目录二,文件准备三,构建四,使用五,在宿主机上连接docker 中的mysql六,推送镜像到Docker hub 一,创建目录 mkdir -p mysql/5.6 二,文件准备 注意执行脚本 ...
- 打开python 交互式模式
pip install jupyter jupyter notebook --ip=127.0.0.1 --port=8888
- Linux基本命令讲解
前言 不多BB,直接上图 Linux命令行的组成结构 [root@oldwang ~]# [root@oldwang ~]# [root@oldwang ~]# [root@oldwang ~]# [ ...