URAL1014 - Product of Digits - 数论
2014-08-07 17:28
316 查看
#include<stdio.h> #include<algorithm> using namespace std; int a[10]; int main() { int n,t; while(scanf("%d",&n)!=EOF) { t=0; if(n==0) { puts("10"); continue; } if(n<=1) { printf("%d\n",n); continue; } for(int i=9;i>1;i--) { if(n%i==0) { a[t++]=i; n=n/i; i++; } } sort(a,a+t); if(n>10) { puts("-1"); continue; } for(int i=0;i<t;i++) { printf("%d",a[i]); } puts(""); } }
相关文章推荐
- URAL 1014 Product of Digits 贪心
- Ural 1014 Product of Digits 解题报告
- A - Product of Digits URAL - 1014(数位操作)
- Ural 1014 Product of Digits NYOJ 270 数的分解 解题报告
- 10 URAL 1014 Product of Digits
- Ural1014-Product of Digits
- Ural 1014 Product of Digits 解题报告
- ural 1014 the product of digits
- Ural 1014-The Product of Digits
- (贪心5.2.6)URAL 1014 Product of Digits(利用数据有序化进行贪心选择)
- URAL 1014 Product of Digits
- ural 1014 Product of Digits
- (贪心5.2.6)URAL 1014 Product of Digits(利用数据有序化进行贪心选择)
- URAL 1014 Product of Digits
- ural 1014
- URAL 1355. Bald Spot Revisited(数论)
- URAL 1876 Centipede's Morning[数论]
- uva 993 Product of digits (分解因子)
- Uniform Generator (hdu1014数论随即数)
- UVa 993 Product of digits(简单数论)