-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproduct of digit 993.cpp
More file actions
88 lines (82 loc) · 1.91 KB
/
product of digit 993.cpp
File metadata and controls
88 lines (82 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define rep(i,n) for(int i=0; i<(int)n; i++)
#define repv(i,n) for(int i=n-1; i>=0; i--)
#define repl(i,n) for(int i=1; i<=(int)n; i++)
#define replv(i,n) for(int i=n; i>=1; i--)
#define INF (1<<28)
#define PI 3.14159265358979323846264338327950
#define pb(x) push_back(x)
#define ppb pop_back
#define all(x) x.begin(),x.end()
#define mem(x,y) memset(x,y,sizeof(x));
#define eps 1e-9
#define pii pair<int,int>
#define pmp make_pair
#define sdi(x) scanf("%d",&x)
#define spdi(x) printf("%d\n",x)
#define sdii(x,y) scanf("%d%d",&x,&y)
#define SDs(x) scanf("%s",x)
#define uu first
#define vv second
using namespace std;
vector < long long > store;
int main ()
{
long long test;
scanf ("%lld" , &test);
long long t;
for (t = 1; t <= test; t++)
{
long long n;
scanf ("%lld" , &n);
if (n <= 9)
printf ("%lld\n" , n);
else
{
store.clear ();
long long i;
for (i = 9; i >= 2; i--)
{
while (n % i == 0)
{
store.push_back (i);
n /= i;
}
}
if (n == 1)
{
sort (store.begin () , store.end ());
long long j;
///cout << "n = " << n << endl;
for (j = 0; j < store.size (); j++)
{
printf ("%lld" , store[j]);
}
printf ("\n");
}
else
{
printf ("-1\n");
}
}
}
}