分析:

举个样例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. Combination Sum I&&II(经典的回溯算法题)

    I: Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C w ...

  2. 02 java 基础:java 文件名与类名关系 CLASSPATH

    java 类修饰符:通常情况下使用 public 修饰,此时,java 强制要求 .java 文件名需与该 public 修饰类名一致,否则无法编译通过.如若没有加修饰符,文件名与类名可无任何关联. ...

  3. bootstrap中如何多次使用一个摸态框

    /**弹出框设置**/ function showjcziimodal(url, width) { $("#jczii-modal").remove();//如果存在此Id的Mod ...

  4. Ubuntu18.04 安装Chrome浏览器

    一路copy paste就OK sudo wget http://www.linuxidc.com/files/repo/google-chrome.list -P /etc/apt/sources. ...

  5. 【PHPExcel实例】 php 导出 excel 实例

    CREATE TABLE `person` ( `) DEFAULT NULL, `name` ) DEFAULT NULL, `birthday` date DEFAULT NULL ) ENGIN ...

  6. POJ1733 Party game [带权并查集or扩展域并查集]

    题目传送 Parity game Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 10870   Accepted: 4182 ...

  7. 日期(date)运用座谈会

    前言 最近老被小伙伴戳:其实这些都是些很基础的东西,一边完善工具类:一边整理一下关于date的常见运用:以后使用起来就不需要到处去找了:争取做到想要的这儿都有. 正文 private static f ...

  8. 认识C++中的bitset类型

    认识标准库bitset类型 位是用来保存一组项或者条件的yes/no(1或者0)信息的一种简洁方法,那么位集就是二进制位的有序集.C++中标准库提供的bitset类在我们程序中就很有效的简化了对于位集 ...

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

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

  10. HDU 6052 To my boyfriend(悬线法)

    [题目链接] http://acm.hdu.edu.cn/showproblem.php?pid=6052 [题目大意] 给出一个数字矩阵,求子矩阵期望数字种数 [题解] 我们统计[x,y]为其所表示 ...