poj magic number
Problem H
Time Limit : 4000/2000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other)
Total Submission(s) : 24 Accepted Submission(s) : 8
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的更多相关文章
- 一个快速double转int的方法(利用magic number)
代码: int i = *reinterpret_cast<int*>(&(d += 6755399441055744.0)); 知识点: 1.reinterpret_cast&l ...
- Magic Number(Levenshtein distance算法)
Magic Number Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u Submit ...
- LVM XFS增加硬盘分区容量(resize2fs: Bad magic number in super-block while)
LVM XFS增加硬盘分区容量(resize2fs: Bad magic number -- :: 分类: Linux LVM XFS增加硬盘分区容量(resize2fs: Bad magic num ...
- [ZOJ 3622] Magic Number
Magic Number Time Limit: 2 Seconds Memory Limit: 32768 KB A positive number y is called magic n ...
- ZOJ 3622 Magic Number(数)
题意 假设一个正整数y满足 将随意正整数x放到y的左边得到的数z满足 z%y==0 那么这个数就是个Magic Number 给你一个范围 求这个范围内Magic Number的个数 令 ...
- iOS Exception Code 之 Magic Number
https://en.wikipedia.org/wiki/Hexspeak iOS Exception Code 之 Magic Number 备忘.
- Magic Number (zoj3622)
Magic Number (zoj3622) Time Limit : 4000/2000ms (Java/Other) Memory Limit : 65536/32768K (Java/Oth ...
- ZOJ 3622 Magic Number 打表找规律
A - Magic Number Time Limit:2000MS Memory Limit:32768KB 64bit IO Format:%lld & %llu Subm ...
- 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 ...
随机推荐
- 漫话JavaScript与异步·第一话——异步:何处惹尘埃
自JavaScript诞生之日起,频繁与异步打交道便是这门语言的使命,并为此衍生出了许多设计和理念.因此,深入理解异步的概念对于前端工程师来说极为重要. 什么是异步? 程序是分"块" ...
- http 请求头
HTTP Request的Header信息 1.HTTP请求方式 如下表: GET 向Web服务器请求一个文件 POST 向Web服务器发送数据让Web服务器进行处理 PUT 向Web服务器发送数据并 ...
- MFC类的结构
1. CObject类,MFC库中绝大部分类的基类,封装了MFC中的最基本机制. 运行时类信息机制/动态创建机制/序列化机制等... 2. CCmdtarget - 消息映射机制最基类 3. CWin ...
- DataReader 和 DataSet 的区别
摘自:http://www.cnblogs.com/zhjjNo1/archive/2009/08/26/1554420.html 第一种解释 DataReader和DataSet最大的区别在于,Da ...
- ajax的访问 WebService 的方法
如果想用ajax进行访问 首先在web.config里进行设置 添加在 <webServices> <protocols> <add name= "HttpPo ...
- Shell中特殊符号
http://blog.chinaunix.net/u1/53027/showart.php?id=482234 在shell中常用的特殊符号罗列如下:# ; ;; . ...
- 网站开发常用jQuery插件总结(五)滚动条插件nanoscroller
网站在展示信息时,如果信息量过大,解决方法主要有三种.1.分页,将信息分页显示.2.整页显示,但是页面过长,影响浏览体验.3.使用滚动条,而默认滚动条样式太单一,用户体验不友好.所以我们需要美化滚动条 ...
- kindeditor编辑器代码过滤解决方法.
很多朋友在使用Kindeditor编辑器的时候都会遇到这样一个问题,如:给A标签加上title属性过后,浏览的时候,却神奇般地发现title属性没有了.再次切换html源代码的时候,返现编辑器将tit ...
- Python 手册(一)
Python 手册 Guido van Rossum Fred L. Drake, Jr., editor PythonLabs Email: python-docs@python.org Rele ...
- web2.0最全的国外API应用集合
web2.0最全的国外API应用集合 原文地址:http://www.buguat.com/post/98.html 2.0时代,越来越多的API被大家广泛应用,如果你还不了解API是何物,请看这里的 ...