Codeforces Round #292 (Div. 2) C. Drazil and Factorial

 

题目地址:http://codeforces.com/contest/515/problem/C

 1 /*  2  无算法,数学问题  3  貌似就是对单个数字分解质因数,替换,然后sort排序就行了  4 */  5 #include <cstdio>  6 #include <iostream>  7 #include <cstring>  8 #include <cmath>  9 #include <algorithm> 10 #include <string> 11 #include <map> 12 #include <vector> 13 #include <set> 14 using namespace std; 15 16 const int MAXN = 1e6 + 10; 17 const int INF = 0x3f3f3f3f; 18 19 string res[10] = {"", "", "2", "3", "322", "5", "53", "7", "7222", "7332"}; 20 21 int main(void) 22 { 23 //freopen ("C.in", "r", stdin); 24 25 int n; 26 while (cin >> n) 27  { 28 string s, ans; 29 cin >> s; 30 for (int i=0; i<s.size(); ++i) 31  { 32 ans += res[s[i] - '0']; 33  } 34  sort (ans.begin (), ans.end ()); 35  reverse (ans.begin (), ans.end ()); 36 37 cout << ans << endl; 38  } 39 40 return 0; 41 }

 

你可能感兴趣的:(codeforces)