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 ...
随机推荐
- java 队列的使用(转载)
转载声明:http://blog.csdn.net/lzy_lizhiyang/article/details/48311925 先我们要知道使用队列的目的是什么?一般情况下,如果是一些及时消息的处理 ...
- 栈和队列在python中的实现
栈和队列是两种基本的数据结构,同为容器类型.两者根本的区别在于: stack:后进先出 queue:先进先出 PS:stack和queue是不能通过查询具体某一个位置的元素而进行操作的.但是他们的排列 ...
- lintcode-491-回文数
491-回文数 判断一个正整数是不是回文数. 回文数的定义是,将这个数反转之后,得到的数仍然是同一个数. 注意事项 给的数一定保证是32位正整数,但是反转之后的数就未必了. 样例 11, 121, 1 ...
- Java throw try catch
public class Runtest { public static void main(String[] args) { // TODO Auto-generated method stub T ...
- bash编程2
bash基础编程 前言:条件测试语法有两种书写模式,一种时[expression] ,另外一种是[[exprssion]] ,为了在书写条件测试的过程中,不让大家将两种格式互相混淆,那么在这里只讲一种 ...
- 《高性能JavaScript》学习笔记(2)——日更中
我说日更就日更,接着....今天从缓冲布局信息开始啦! -------------------2016-7-22 21:09:12------------------------------- 14. ...
- 【beta】Scrum站立会议第5次....11.7
小组名称:nice! 组长:李权 成员:于淼 刘芳芳韩媛媛 宫丽君 项目内容:约跑app(约吧) 时间:2016.11.7 12:00——12:30 地点:传媒西楼220室 本次对beta阶段的 ...
- oracle 不能是用变量来作为列名和表名 ,但使用动态sql可以;
ORACLE 不能使用变量来作为列名 和表名 一下是个人的一些验证: DECLARE ename1 emp.ename%TYPE ; TYPE index_emp_type ) INDEX BY PL ...
- JVM初识、调优
JVM是按照运行时数据的存储结构来划分内存结构的,JVM在运行java时,将他们划分成几种不同格式的数据,分别存储在不同的区域,这些数据统一称为运行时数据,运行时数据包括java程序本身的数据信息和J ...
- 记一次Spring配置事故
在引入Spring的Validated时,需要声明如下bean: @Beanpublic MethodValidationPostProcessor methodValidationPostPro ...