Problem H

Time Limit : 4000/2000ms (Java/Other)   Memory Limit : 65536/32768K (Java/Other)
Total Submission(s) : 24   Accepted Submission(s) : 8
Problem Description
A positive number y is called magic number if for every positive integer x it satisfies that put y to the right of x, which will form a new integer z, z mod y = 0.

Input

The input has multiple cases, each case contains two positve integers m, n(1 <= m <= n <= 2^31-1), proceed to the end of file.

Output

For each case, output the total number of magic numbers between m and n(m, n inclusively).

Sample Input

1 1
1 10

Sample Output

1
4
怎样打表
这些数都是有规律的从100开始后面都只是加了个0而已,所以可以很快找出来。pow(2,31)=2147483648;
 #include<stdio.h>
#include<math.h>
int main()
{
long long int a[]={,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, , , ,, , , , ,, , ,, ,, };
long long m,n,i,t;//不能用I64,wa了用long long,而且vc编译器是非法的。
while(~scanf("%lld%lld",&m,&n))
{
t=;
for(i=;i<;i++)
{
if(a[i]>=m&&a[i]<=n)
t++;
if(a[i]>n)
break;
}
printf("%lld\n",t);
}
return ;
}

把数组的那些数是怎样弄出来的代码:

#include<stdio.h>
#include<math.h>
int main()
{
__int64 x,y,t=,m,k;
while(scanf("%I64d%I64d",&x,&y)!=EOF)
{
int i,j;
k=;
for(i=;i<pow(,);i++)
{
t=;
m=i;
while(m)
{
t++;m/=;
}
int p=;
for(j=;j<=i;j++)
{
if((j*(__int64)pow(,t))%i)
{
p=;
break;
}
}
if(p)
{
printf("%I64d ",i);
}
}
printf("\n");
}
return ;
}

poj magic number的更多相关文章

  1. 一个快速double转int的方法(利用magic number)

    代码: int i = *reinterpret_cast<int*>(&(d += 6755399441055744.0)); 知识点: 1.reinterpret_cast&l ...

  2. Magic Number(Levenshtein distance算法)

    Magic Number Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Submit ...

  3. LVM XFS增加硬盘分区容量(resize2fs: Bad magic number in super-block while)

    LVM XFS增加硬盘分区容量(resize2fs: Bad magic number -- :: 分类: Linux LVM XFS增加硬盘分区容量(resize2fs: Bad magic num ...

  4. [ZOJ 3622] Magic Number

    Magic Number Time Limit: 2 Seconds      Memory Limit: 32768 KB A positive number y is called magic n ...

  5. ZOJ 3622 Magic Number(数)

    题意  假设一个正整数y满足  将随意正整数x放到y的左边得到的数z满足 z%y==0  那么这个数就是个Magic Number   给你一个范围  求这个范围内Magic Number的个数 令 ...

  6. iOS Exception Code 之 Magic Number

    https://en.wikipedia.org/wiki/Hexspeak  iOS Exception Code 之 Magic Number 备忘.

  7. Magic Number (zoj3622)

    Magic Number (zoj3622) Time Limit : 4000/2000ms (Java/Other)   Memory Limit : 65536/32768K (Java/Oth ...

  8. ZOJ 3622 Magic Number 打表找规律

    A - Magic Number Time Limit:2000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Subm ...

  9. resize2fs: Bad magic number in super-block while trying to open

    I am trying to resize a logical volume on CentOS7 but am running into the following error: resize2fs ...

随机推荐

  1. 02_天气查询_socket方式模拟_单线程

    [远程请求的B/S模式(客户端/服务器)] TCP: 是一种传输层协议,一种面向连接的协议.经过三次握手客户端和服务器端连接一个连接(通道).提供可靠的数据传输,该协议一般服务质量要求比较高的情况,T ...

  2. What is the Xcopy Command?:

    Quote from: http://pcsupport.about.com/od/commandlinereference/p/xcopy-command.htm The xcopy command ...

  3. [翻译][MVC 5 + EF 6] 2:基础的增删改查(CRUD)

    原文:Implementing Basic CRUD Functionality with the Entity Framework in ASP.NET MVC Application 1.修改Vi ...

  4. 理解Http协议(一)

    本文对Http协议进行了简要的描述,说明了其用途的广泛性:通过代码对Http连接和Http请求消息的发送进行实现,希望能将这些抽象的过程直观的显示出来:最后对HttpURL和Http协议中“资源”这些 ...

  5. webapp中的日期选择

    你是否在开发webapp时,选择用哪种第三方日期选择控件绞尽脑汁? 其实不用那么麻烦,现在移动端都是WebKit内核,支持HTML5,其实只要弱弱的将input中将type="date&qu ...

  6. (转载)Delphi StringGrid常用属性和常用操作

    Delphi StringGrid常用属性和常用操作 StringGrid组件用于建立显示字符串的网格,与电子表格相似.它可使表格中的字符串和相关对象操作简单化.StringGrid组件提供了许多可控 ...

  7. C++ static全局变量与全局变量的区别/static全局函数与全局函数的区别

    全局变量(外部变量)的说明之前再冠以static 就构成了静态的全局变量.全局变量本身就是静态存储方式, 静态全局变量当然也是静态存储方式.这两者在存储方式上并无不同.这两者的区别虽在于非静态全局变量 ...

  8. PYTHON 获取机器硬件信息及状态

    #!/usr/bin/env python # encoding: utf-8 from optparse import OptionParser import os import re import ...

  9. uboot顶层config.mk分析

    uboot顶层目录中的config.mk定义了确定了当前执行makefile所对应的源文件目录.目标文件目录,编译的程序编译.连接的选项,以及目标文件生成的规则等等.它被包含在顶层的makefile以 ...

  10. Ajax编程相对路径与绝对路径

    http://www.worlduc.com/blog2012.aspx?bid=16946309 ajax同一域名调用采用相对路径 var url = 'QuerySingleDataByField ...