-
Notifications
You must be signed in to change notification settings - Fork 8
/
Helper.h
76 lines (66 loc) · 1.2 KB
/
Helper.h
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
#pragma once
#include <cmath>
#include <iostream>
#include "string.h"
#include <cmath>
#include "Encoder.h"
#include "Decoder.h"
#include "Generators.h"
#include <stdio.h>
#define max(a,b) (((a) > (b)) ? (a) : (b))
#define min(a,b) (((a) < (b)) ? (a) : (b))
struct PartitionS {
int IL;
int IS;
int JL;
int JS;
};
class Helper {
public:
Helper();
virtual ~Helper();
private:
int Kmax;
int P;
int F;
int W;
int Al;
int Kmin;
int Gmax;
int G;
int T;
int Kt;
int Z;
int N;
PartitionS KtZ;
PartitionS TAlN;
public:
const int getKmax();
const int getP();
const int getF();
const int getW();
const int getAl();
const int getKmin();
const int getGmax();
const int getG();
const int getT();
const int getKt();
const int getZ();
const int getN();
const PartitionS getKtZ();
const PartitionS getTAlN();
public:
bool init(int Al, int Kmin , int Gmax, int P, int F, int W);
public:
const PartitionS partition(int I, int J);
public:
void toString();
};
const static long Combin(int m, int n) {
if (n==1||n==0)
return m;
if (n > m-n) {
return Combin(m, m-n);
}
return (long)((double)Combin(m-1,n-1)*m/n);
}