牛客网暑期ACM多校训练营(第三场)H Diff-prime Pairs (贡献)
牛客网暑期ACM多校训练营(第三场)H Diff-prime Pairs (贡献)
链接:https://ac.nowcoder.com/acm/contest/141/H来源:牛客网
Eddy has solved lots of problem involving calculating the number of coprime pairs within some range. This problem can be solved with inclusion-exclusion method. Eddy has implemented it lots of times. Someday, when he encounters another coprime pairs problem, he comes up with diff-prime pairs problem. diff-prime pairs problem is that given N, you need to find the number of pairs (i, j), where igcd(i,j)\frac{i}{gcd(i, j)}gcd(i,j)i and jgcd(i,j)\frac{j}{gcd(i,j)}gcd(i,j)j are both prime and i ,j ≤ N. gcd(i, j) is the greatest common divisor of i and j. Prime is an integer greater than 1 and has only 2 positive divisors.
Eddy tried to solve it with inclusion-exclusion method but failed. Please help Eddy to solve this problem.
Note that pair (i1, j1) and pair (i2, j2) are considered different if i1 ≠ i2 or j1 ≠ j2.
输入描述:
Input has only one line containing a positive integer N.1 ≤ N ≤ 107
输出描述:
Output one line containing a non-negative integer indicating the number of diff-prime pairs (i,j) where i, j ≤ N
示例1
输入
[复制](javascript:void(0)
最新文章
- 对《分享一下自己用c++写的小地图》一文的补充
- 正则表达式在python中的应用
- 周末娱乐一下--------恶搞windows小脚本
- Codeforces Beta Round #5
- 如何通过源码生成Gatling可执行工具
- ArcGIS Desktop 与 Excel(转)
- hdoj 1166 敌兵布阵【线段树求区间最大值+单点更新】
- BZOJ 1801 AHOI2009 中国象棋 递归
- Tapestry: Obtained resource by @Inject is NULL
- 分考场(无向图着色问题)(dfs回溯)
- 解决 asp.net core 中下载 exe 文件返回 404
- Swagger2限定接口范围
- CSS让页面平滑滚动
- `define、parameter、localparam三者的区别(转)
- ubuntu下安装vmTools, 和共享文件
- MySQL 同一实例不同库之间表同步(Otter 应用)
- .Net Core使用Unity替换原生DI
- 利用python制作电子签名
- hdu 5288 OO’s Sequence(2015多校第一场第1题)枚举因子
- ios开发 内测包添加测试UDID