-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path10879 - Code Refactoring.cpp
71 lines (58 loc) · 1.33 KB
/
10879 - Code Refactoring.cpp
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
/// Name: Md. Samshad Rahman
/// Prob: 10879 - Code Refactoring
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <cctype>
#include <string>
#include <stack>
#include <queue>
#include <list>
#include <vector>
#include <map>
#include <sstream>
#include <bitset>
#include <utility>
#include <fstream>
#include <set>
#include <ctime>
#define co cout
#define ci cin
#define sf1(x) scanf("%d", &x)
#define tkc(x) scanf("%c", &x)
#define sf scanf
#define pf1(x) printf("%d ", x)
#define pfc(x) printf("%c", x)
#define pf printf
#define FOR(i,j,k) for(i = j; i < k; i++)
#define mem(x,n) memset((x),(n),sizeof((x)))
#define pi acos(-1.0)
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef pair<int,int> PII;
typedef vector< PII > VII;
const double EPS = 1e-11;
int main(){
int k, l, pos, a[10], cs = 0, t;
sf1(t);
while(t--){
sf1(k);
pos = 0;
int len = (int) sqrt(k);
FOR(l, 2, len+3){
if(k % l == 0){
a[pos++] = l;
a[pos++] = k / l;
if(pos == 4)
break;
}
}
pf("Case #%d: %d = %d * %d = %d * %d\n", ++cs, k, a[0], a[1], a[2], a[3]);
}
return 0;
}