hdu4279 Number
来源:互联网 发布:windows系统下载 编辑:程序博客网 时间:2024/06/11 04:53
Number
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2284 Accepted Submission(s): 632
Problem Description
Here are two numbers A and B (0 < A <= B). If B cannot be divisible by A, and A and B are not co-prime numbers, we define A as a special number of B.
For each x, f(x) equals to the amount of x’s special numbers.
For example, f(6)=1, because 6 only have one special number which is 4. And f(12)=3, its special numbers are 8,9,10.
When f(x) is odd, we consider x as a real number.
Now given 2 integers x and y, your job is to calculate how many real numbers are between them.
For each x, f(x) equals to the amount of x’s special numbers.
For example, f(6)=1, because 6 only have one special number which is 4. And f(12)=3, its special numbers are 8,9,10.
When f(x) is odd, we consider x as a real number.
Now given 2 integers x and y, your job is to calculate how many real numbers are between them.
Input
In the first line there is an integer T (T <= 2000), indicates the number of test cases. Then T line follows, each line contains two integers x and y (1 <= x <= y <= 2^63-1) separated by a single space.
Output
Output the total number of real numbers.
Sample Input
21 11 10
Sample Output
04HintFor the second case, the real numbers are 6,8,9,10.
Source
2012 ACM/ICPC Asia Regional Tianjin Online
Recommend
liuyiding
暴力打表找规律
#include <iostream>#include <stdio.h>#include <string.h>#include <math.h>using namespace std;__int64 num[15]={0,0,0,0,0,0,1,1,2,3,4,4,5};__int64 get(__int64 x){ if(x<=12)return num[x]; __int64 temp=(__int64)sqrt((double)x); if(temp&1) return x/2-1; else return x/2-2; return -1;}int main(){ int tcase; __int64 m,n; scanf("%d",&tcase); while(tcase--) { scanf("%I64d%I64d",&n,&m); n--; __int64 p1=get(n); __int64 p2=get(m); printf("%I64d\n",p2-p1); } return 0;}
- HDU4279-Number
- hdu4279 Number
- hdu4279 Number
- hdu4279
- hdu4279
- hdu4279 Number-------天津网络赛 打表找规律
- 2012天津赛区网络赛第二题---Number(hdu4279)
- hdu4279数论
- HDU4279(数论)
- hdu4279 找规律+小想法
- HDU4279(2012年天津网络赛---数论分析题)
- Number
- number
- number
- Number
- number
- number
- Number
- Hbase深入学习(四) Hbase操作命令列表
- 常用的工具
- ubuntu 下安装rails!
- Ubuntu Linux下的Webdav 命令行客户端
- lua的一些程序片段
- hdu4279 Number
- Android SERVICE后台服务进程的自启动和保持
- pppd错误码
- Eric5 IDE for Python在window是下安装
- android如何实现开机自动启动Service或app
- hud4278 Faulty Odometer
- 两道选择题 -- 爱
- css去掉li标签前面的点
- SharePoint PeopleEditor 控件的使用