分析:

举个样例xxx(三位数)为魔力数,则xxx|(xxx+1000*y),那么xxx|1000,这个就是结论

同理:四位数xxxx|10000,五位数xxxxx|100000

代码:

#include<iostream>
#include<cstdio>
#include<cmath>
#include<map>
#include<queue>
#include<cstring>
#include<algorithm>
typedef long long LL;
using namespace std; const int maxn=600005;
LL p[maxn];
int main()
{
LL a,b;
while(~scanf("%lld%lld",&a,&b))
{
LL cnt=0;
for(LL i=10;i<1000000000000;i*=10)
{
for(LL j=10;j>1;j--)
if(i%j==0&&i/j>=i/10)p[cnt++]=i/j;
}
sort(p,p+cnt);
LL ans=upper_bound(p,p+cnt,b)-lower_bound(p,p+cnt,a);
printf("%lld\n",ans);
}
return 0;
}

ZOJ3622 Magic Number(水题)的更多相关文章

  1. Codeforces Round #335 (Div. 2) A. Magic Spheres 水题

    A. Magic Spheres Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://www.codeforces.com/contest/606/ ...

  2. Xtreme8.0 - Magic Square 水题

    Xtreme8.0 - Magic Square 题目连接: https://www.hackerrank.com/contests/ieeextreme-challenges/challenges/ ...

  3. Codeforces Round #369 (Div. 2) B. Chris and Magic Square 水题

    B. Chris and Magic Square 题目连接: http://www.codeforces.com/contest/711/problem/B Description ZS the C ...

  4. Educational Codeforces Round 76 (Rated for Div. 2) B. Magic Stick 水题

    B. Magic Stick Recently Petya walked in the forest and found a magic stick. Since Petya really likes ...

  5. codeforces 711B B. Chris and Magic Square(水题)

    题目链接: B. Chris and Magic Square 题意: 问在那个空位子填哪个数可以使行列对角线的和相等,就先找一行或者一列算出那个数,再验证是否可行就好; AC代码: #include ...

  6. HDOJ(HDU) 1562 Guess the number(水题,枚举就行)

    Problem Description Happy new year to everybody! Now, I want you to guess a minimum number x betwwn ...

  7. zzulioj--1817--match number(水题)

    1817: match number Time Limit: 1 Sec  Memory Limit: 128 MB Submit: 98  Solved: 45 SubmitStatusWeb Bo ...

  8. Magic Number (zoj3622)

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

  9. hdu 1005:Number Sequence(水题)

    Number Sequence Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)T ...

随机推荐

  1. Palindrome Partitioning——回溯算法的又一经典

    Given a string s, partition s such that every substring of the partition is a palindrome. Return all ...

  2. 寻找与网页内容相关的图片(二)reddit的做法

    正如前文所述,内容聚合网站,比如新浪微博.推特.facebook等网站对于网页的缩略图是刚需.为了让分享的内容引人入胜,网页的图片缩略图是必不可少的.年轻人的聚集地.社交新闻网站reddit也是一个这 ...

  3. MITx 创业101 寻找你的顾客

    来自MITx的创业课 步骤一 市场分割(Market Segmentation) 头脑风暴所有可能的市场,关注可能性 寻找最终用户(End User)——会使用你的产品的用户,但不一定会付钱 思考产品 ...

  4. PHP读取文件夹的文件列表

    /** * getDir()取文件夹列表,getFile()取对应文件夹下面的文件列表,二者的区别在于判断有没有“.”后缀的文件,其他都一样 */ //获取文件目录列表,该方法返回数组 functio ...

  5. [thinkphp] 隐藏后台地址

    转自 http://document.thinkphp.cn/manual_3_2.html#module_deploy 如果不希望用户直接访问某个模块,可以设置模块映射(对后台的保护会比较实用). ...

  6. phpstorm如何进行文件或者文件夹重命名

    1.phpstorm的重构 1.1重命名 在phpstorm中,右键点击我们要进行修改的文件,然后又一项重构,我们就可以进行对文件的重命名. 接下来点击重命名进行文件或者文件夹的重新命名. 在框中输入 ...

  7. cogs 1075. [省常中2011S4] 最短路径问题

    1075. [省常中2011S4] 最短路径问题 ★   输入文件:short.in   输出文件:short.out   简单对比 时间限制:1 s   内存限制:128 MB [问题描述] 平面上 ...

  8. poj 3225 Help with Intervals(线段树,区间更新)

    Help with Intervals Time Limit: 6000MS   Memory Limit: 131072K Total Submissions: 12474   Accepted:  ...

  9. poj 1127(直线相交+并查集)

    Jack Straws Description In the game of Jack Straws, a number of plastic or wooden "straws" ...

  10. 【循环节】【矩阵乘法】MIPT-2016 Pre-Finals Workshop, Taiwan NTU Contest, Sunday, March 27, 2016 Problem F. Fibonacci of Fibonacci

    题意:F(n)为斐波那契数列的第n项,问你F(F(n)) mod 20160519的值. 发现有循环节,F(26880696)=0,F(26880697)=1,.... 于是两次矩乘快速幂即可. #i ...