B. Little Elephant and Numbers
time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

The Little Elephant loves numbers.

He has a positive integer x. The Little Elephant wants to find the number of positive integers d, such that d is the divisor of x, and x andd have at least one common (the same) digit in their decimal representations.

Help the Little Elephant to find the described number.

Input

A single line contains a single integer x (1 ≤ x ≤ 109).

Output

In a single line print an integer — the answer to the problem.

Examples
input
  1. 1
output
  1. 1
input
  1. 10
output
  1. 2
  2.  
  3. 题意:输出是x的因子且与x有相同数字的因子个数
  1. #include<cstdio>
  2. #include<cmath>
  3. using namespace std;
  4. int x,ans;
  5. bool v[];
  6. int main()
  7. {
  8. scanf("%d",&x);
  9. int n=sqrt(x),m=x;
  10. while(x) { v[x%]=true; x/=; }
  11. int k,j,i;
  12. for(k=;k<=n;k++)
  13. if(m%k==)
  14. {
  15. j=m/k;i=k;
  16. while(i)
  17. {
  18. if(v[i%])
  19. {
  20. ans++; break;
  21. }
  22. i/=;
  23. }
  24. if(j==k) continue;
  25. while(j)
  26. {
  27. if(v[j%])
  28. {
  29. ans++; break;
  30. }
  31. j/=;
  32. }
  33. }
  34. printf("%d",ans);
  35. }
  1.  

Codeforces 221 B. Little Elephant and Numbers的更多相关文章

  1. Codeforces 221 E. Little Elephant and Shifts

    E. Little Elephant and Shifts time limit per test 2 seconds memory limit per test 256 megabytes inpu ...

  2. Codeforces 221 D. Little Elephant and Array

    D. Little Elephant and Array time limit per test 4 seconds memory limit per test 256 megabytes input ...

  3. Codeforces 221 C. Little Elephant and Problem

    C. Little Elephant and Problem time limit per test 2 seconds memory limit per test 256 megabytes inp ...

  4. Codeforces 221 A. Little Elephant and Function

    A. Little Elephant and Function time limit per test 2 seconds memory limit per test 256 megabytes in ...

  5. AC日记——Little Elephant and Numbers codeforces 221b

    221B - Little Elephant and Numbers 思路: 水题: 代码: #include <cmath> #include <cstdio> #inclu ...

  6. Codeforces 221d D. Little Elephant and Array

    二次联通门 : Codeforces 221d D. Little Elephant and Array /* Codeforces 221d D. Little Elephant and Array ...

  7. Codeforces Round #131 (Div. 1) B. Numbers dp

    题目链接: http://codeforces.com/problemset/problem/213/B B. Numbers time limit per test 2 secondsmemory ...

  8. Codeforces Beta Round #51 D. Beautiful numbers 数位dp

    D. Beautiful numbers Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/55/p ...

  9. Educational Codeforces Round 13 A. Johny Likes Numbers 水题

    A. Johny Likes Numbers 题目连接: http://www.codeforces.com/contest/678/problem/A Description Johny likes ...

随机推荐

  1. 20181016-4 Alpha阶段第2周/共2周 Scrum立会报告+燃尽图 05

    作业要求参见:https://edu.cnblogs.com/campus/nenu/2018fall/homework/2288 Scrum master:王硕 一.小组介绍 组长:王一可 组员:范 ...

  2. 软件工程 speedsnail 第二次冲刺10

    20150527 完成任务:蜗牛碰到线后速度方向的调整:已经基本实现多方向的反射: 遇到问题: 问题1 反射角的问题 解决1 利用tan()三角函数 明日任务: 大总结.找到新问题.布置下一次冲刺方案

  3. 用P4对数据平面进行编程

    引言 SDN架构强调了对控制平面的可编程,数据平面只负责转发,导致数据平面很大程度上受制于功能固定的包处理硬件. P4语言的特性: 目标无关性:P4语言不受制于具体设备,所有可编程芯片都可以使用P4编 ...

  4. lintcode-65-两个排序数组的中位数

    65-两个排序数组的中位数 两个排序的数组A和B分别含有m和n个数,找到两个排序数组的中位数,要求时间复杂度应为O(log (m+n)). 样例 给出数组A = [1,2,3,4,5,6] B = [ ...

  5. 利用canvas对上传图片进行上传前压缩

    利用谷歌调式工具发现,图片大小直接影响着首屏加载时间. 且考虑到后期服务端压力,图片压缩特别必要. 本文是前端利用canvas实现图片.参考文章:https://www.cnblogs.com/007 ...

  6. libnl3.2.25安装编译

    1,tar zxvf libnl-3.2.25.tar.gz 2,cd libnl-3.2.25 3,./configure --prefix=/usr  --sysconfdir=/etc  --d ...

  7. PHP面向对象之重写

    覆盖(override): 基本概念 覆盖,又叫“重写”: 含义: 将一个类从父类中继承过来的属性和方法“重新定义”——此时相当于子类不想用父类的该属性或方法,而是想要定义. 覆盖的现实需要: 对于一 ...

  8. Spring MVC @RequestParam @RequestHeader @CookieValue用法

    摘要: package com.hust.springmvc1; import org.springframework.stereotype.Controller; import org.spring ...

  9. Redis 备份数据的两种方式

    既然是数据库,那就一定有数据备份方式了,而且 Redis 是内存形式的数据库,更需要数据备份了,要不然断电数据就全都丢失了. Redis 数据备份有两种方式: RDB(数据快照) AOF(记录操作日志 ...

  10. 【linux使用】bash shell命令行常用快捷键

    移动: Ctrl + A: 移动到当前编辑的命令行首, Ctrl + E: 移动到当前编辑的命令行尾, Ctrl + F 或 ->:按字符右移(往命令行尾部方向,前移) Ctrl + B 或 & ...