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
output
1
input
10
output
2

题意:输出是x的因子且与x有相同数字的因子个数
#include<cstdio>
#include<cmath>
using namespace std;
int x,ans;
bool v[];
int main()
{
scanf("%d",&x);
int n=sqrt(x),m=x;
while(x) { v[x%]=true; x/=; }
int k,j,i;
for(k=;k<=n;k++)
if(m%k==)
{
j=m/k;i=k;
while(i)
{
if(v[i%])
{
ans++; break;
}
i/=;
}
if(j==k) continue;
while(j)
{
if(v[j%])
{
ans++; break;
}
j/=;
}
}
printf("%d",ans);
}

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. 王者荣耀交流协会final发布WBS+PSP

    WBS: PSP: 时间为估计,大致精确. 类型 personal software process stages 预估时间 实际花费时间 planning 计划 4h 4h estimate 4h ...

  2. MathExamV2.0四则混合运算计算题生成器

    MathExamV2.0四则混合运算计算题生成器----211606360 丁培晖 211606343 杨宇潇 一.预估与实际 PSP2.1 Personal Software Process Sta ...

  3. c# apache服务器请求得到数据(初级)

    1.代码: string data = new WebClient().DownloadString("http://localhost:81/123.txt");

  4. VC++调试基础

    一.调试基础 调试快捷键 F5:  开始调试 Shift+F5: 停止调试 F10:   调试到下一句,这里是单步跟踪 F11:   调试到下一句,跟进函数内部 Shift+F11:  从当前函数中跳 ...

  5. java之静态代理与动态代理

    先看看静态代理是如何操作的 定义接口: public interface Person { public void sayHello(String content, int age); public ...

  6. postgis_LayerTransform

    [转] postgis_LayerTransform 一个在postgis中结合中国国情,批量对数据进行加偏到百度坐标,高德谷歌的火星坐标,或者逆向纠偏 安装: 在postgresql-postgis ...

  7. HDU4054_Hexadecimal View

    水题.直接八位八位地枚举即可. 注意控制输出,注意读数的时候要把s中的全部元素置零. #include <iostream> #include <cstdio> #includ ...

  8. 【uoj#48】[UR #3]核聚变反应强度 数论

    题目描述 给出一个长度为 $n$ 的数列 $a$ ,求 $a_1$ 分别与 $a_1...a_n$ 的次大公约数.不存在则输出-1. 输入 第一行一个正整数 $n$ . 第二行 $n$ 个用空格隔开的 ...

  9. 【JavaScript&jQuery】省市区三级联动

    HTML: <%@page import="com.mysql.jdbc.Connection"%> <%@ page language="java&q ...

  10. Innobackupx工具命令简单解析

    --defaults-file 同xtrabackup的--defaults-file参数,指定mysql配置文件; --apply-log 对xtrabackup的--prepare参数的封装; - ...