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 ...
随机推荐
- 王者荣耀交流协会final发布WBS+PSP
WBS: PSP: 时间为估计,大致精确. 类型 personal software process stages 预估时间 实际花费时间 planning 计划 4h 4h estimate 4h ...
- MathExamV2.0四则混合运算计算题生成器
MathExamV2.0四则混合运算计算题生成器----211606360 丁培晖 211606343 杨宇潇 一.预估与实际 PSP2.1 Personal Software Process Sta ...
- c# apache服务器请求得到数据(初级)
1.代码: string data = new WebClient().DownloadString("http://localhost:81/123.txt");
- VC++调试基础
一.调试基础 调试快捷键 F5: 开始调试 Shift+F5: 停止调试 F10: 调试到下一句,这里是单步跟踪 F11: 调试到下一句,跟进函数内部 Shift+F11: 从当前函数中跳 ...
- java之静态代理与动态代理
先看看静态代理是如何操作的 定义接口: public interface Person { public void sayHello(String content, int age); public ...
- postgis_LayerTransform
[转] postgis_LayerTransform 一个在postgis中结合中国国情,批量对数据进行加偏到百度坐标,高德谷歌的火星坐标,或者逆向纠偏 安装: 在postgresql-postgis ...
- HDU4054_Hexadecimal View
水题.直接八位八位地枚举即可. 注意控制输出,注意读数的时候要把s中的全部元素置零. #include <iostream> #include <cstdio> #includ ...
- 【uoj#48】[UR #3]核聚变反应强度 数论
题目描述 给出一个长度为 $n$ 的数列 $a$ ,求 $a_1$ 分别与 $a_1...a_n$ 的次大公约数.不存在则输出-1. 输入 第一行一个正整数 $n$ . 第二行 $n$ 个用空格隔开的 ...
- 【JavaScript&jQuery】省市区三级联动
HTML: <%@page import="com.mysql.jdbc.Connection"%> <%@ page language="java&q ...
- Innobackupx工具命令简单解析
--defaults-file 同xtrabackup的--defaults-file参数,指定mysql配置文件; --apply-log 对xtrabackup的--prepare参数的封装; - ...