Codeforces 221 B. Little Elephant and Numbers
2 seconds
256 megabytes
standard input
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.
A single line contains a single integer x (1 ≤ x ≤ 109).
In a single line print an integer — the answer to the problem.
1
1
10
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的更多相关文章
- 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 ...
- 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 ...
- 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 ...
- 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 ...
- AC日记——Little Elephant and Numbers codeforces 221b
221B - Little Elephant and Numbers 思路: 水题: 代码: #include <cmath> #include <cstdio> #inclu ...
- Codeforces 221d D. Little Elephant and Array
二次联通门 : Codeforces 221d D. Little Elephant and Array /* Codeforces 221d D. Little Elephant and Array ...
- Codeforces Round #131 (Div. 1) B. Numbers dp
题目链接: http://codeforces.com/problemset/problem/213/B B. Numbers time limit per test 2 secondsmemory ...
- 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 ...
- Educational Codeforces Round 13 A. Johny Likes Numbers 水题
A. Johny Likes Numbers 题目连接: http://www.codeforces.com/contest/678/problem/A Description Johny likes ...
随机推荐
- Scrum立会报告+燃尽图(十月二十九日总第二十次)
此作业要求参见:https://edu.cnblogs.com/campus/nenu/2018fall/homework/2288 项目地址:https://git.coding.net/zhang ...
- 【树上DFS】Tree and Polynomials
http://codeforces.com/gym/101372 D push1[i][k]:所有操作1总共要让节点i下推多少系数k push2[i][k]:所有操作2总共要让节点i上推多少系数k s ...
- 2014-2015 ACM-ICPC, NEERC, Eastern Subregional Contest Problem H. Pair: normal and paranormal
题目链接:http://codeforces.com/group/aUVPeyEnI2/contest/229669 时间限制:1s 空间限制:64MB 题目大意:给定一个长度为2n,由n个大写字母和 ...
- Python数据挖掘学习路程--起步
一.首先第一步我去了解了Python开发环境:Python(程序运行基础的解释器)+第三方类库(功能扩展)+编辑器(提高代码编辑效率) 编辑器有:Pycharm.Spyder.jupyter note ...
- ViewController 视图控制器的常用方法
ViewController 视图控制器 ,是控制界面的控制器,通俗的来说,就是管理我们界面的大boss,视图控制器里面包含了视图,下面举个例子,让视图在两个视图上调转. 定义一个视图控制器: MyV ...
- centos系统下禁用笔记本触控板
最近把零几年的老爷笔记本拿出来用,使用windows系统实在太卡了,于是折腾安装上Centos系统了,但是在使用的过程中发现鼠标经常失效.使用了多种方法(比如:http://blog.csdn.net ...
- 微信小程序 跳坑
http://www.wxapp-union.com/forum.php?mod=viewthread&tid=3270
- 第193天:js---Math+Error+Number+Object总结
一.Math 随机选取 //随机选取 function getRandom (begin,end){ return Math.floor(Math.random()*(end-begin))+begi ...
- js function的方法名是一个变量 能被重复定义 当变量名一致时候 会使用最后一个function
- bzoj1390 [CEOI2008] Fence
题意 给出n个白点和m个黑点.现在你需要选择一些白点把黑点圈起来.每有一个黑点不能被选出的白点组成的凸包包含就需要付出111的代价,每选出一个白点就需要付出20的代价.要求最小化代价之和 n,m< ...