codeforces 221B Little Elephant and Numbers
来源:互联网 发布:怎样做app软件 编辑:程序博客网 时间:2024/05/18 03:06
题目的意思是说给定一个数x,找到满足情况(d是x的约数,且d和x有至少一个相同的数字)d的个数,直接模拟就可以了。
#include <iostream>#include <cstdio>#include <cstring>using namespace std;int main(){ int n,m,i,j; int ans=0; int a[10]; memset(a,0,sizeof(a)); scanf("%d",&n); m=n; while(n) { a[n%10]++; n/=10; } for(i=1;i*i<=m;i++) { if(m%i==0) { j=i; while(j) { if(a[j%10]) {ans++;break;} j/=10; } j=m/i; if(i*i!=m) while(j) { if(a[j%10]) {ans++;break;} j/=10; } } } if(m==1) printf("1\n"); else printf("%d\n",ans); return 0;}
0 0
- codeforces 221B Little Elephant and Numbers
- CodeForces-221B-Little Elephant and Numbers [枚举]
- B. Little Elephant and Numbers
- Codeforces Round #136 (Div. 2) B. Little Elephant and Numbers
- Codeforces Round #136 (Div. 2) / 221B Little Elephant and Numbers (数论)
- codeblocks B - Little Elephant and Numbers
- Codeforces 220B Little Elephant and Array
- CodeForces 220B Little Elephant and Array
- CodeForces 204B - Little Elephant and Cards
- codeforces 204B- Little Elephant and Cards
- Codeforces-258B Little Elephant and Elections
- Codeforces 258B Little Elephant and Elections
- Codeforces 204B Little Elephant and Cards
- Codeforces 258B - Little Elephant and Elections
- codeforces 221D Little Elephant and Array
- codeforces 221C Little Elephant and Problem
- codeforces 221D Little Elephant and Array
- Codeforces Round #129 (Div. 1) B. Little Elephant and Cards
- 小议云存储和网盘
- 不要在意别人怎么说和怎么看,给自己一个机会
- WCF中FaultException的使用意义
- 一个b2c设计草稿(遗憾的终止计划)
- [Jobdu OJ] 1006 ZOJ问题
- codeforces 221B Little Elephant and Numbers
- poj 3320 Jessica's Reading Problem
- POJ 2029 Get Many PersimmonTrees(二维树状数组or递推)
- Eclipse在linux使用记录
- linux 的ulimit命令
- The Last Ant(模拟)
- 【Qt编程】Qt学习笔记<三>
- 第四周上机实践项目——程序的多文件组织
- Java 8 正式版发布