-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain_general.cpp
122 lines (119 loc) · 3.04 KB
/
main_general.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#include <iostream>
#include <stdlib.h>
#include <iomanip>
#include <ctime>
#include "drawing.h"
//#define Randmod(x) rand()%x
using namespace std;
int main() {
int total = 0;
int sum = 0;
unsigned int dian = 0, trial = 0, peach = 0;
bool chou = 0;
bool baodi_c = 0;
int baodi_w = 0;
srand((unsigned)time(NULL));
cout << "你要抽什么? 0=角色池,1=武器池" << endl;
chou = getData<bool>(chou, 0);
cin.sync();
if (chou == 1) {
cout << "垫之前歪几次?" << endl;
baodi_w = getData<int>(baodi_w, 1);
cin.sync();
cout << "输入已垫次数:" << endl;
dian = getData<unsigned int>(dian, 1);
while (1) {
cin.sync();
if (baodi_w == 1 && dian >= 80) {
cout << "你已经是小保底了,为啥还多于80次捏?(╯‵□′)╯︵┻━┻,请重新输入~" << endl;
dian = getData<unsigned int>(dian, 1);
} else break;
}
} else {
cout << "垫之前是小保底还是大保底? 1=小,0=大" << endl;
baodi_c = getData<bool>(baodi_c, 0);
cin.sync();
cout << "输入已垫次数:" << endl;
dian = getData<unsigned int>(dian, 1);
while (1) {
cin.sync();
if (baodi_c == 1 && dian >= 90) {
cout << "你已经是小保底了,为啥还多于90次捏?(╯‵□′)╯︵┻━┻,请重新输入~" << endl;
dian = getData<unsigned int>(dian, 1);
} else break;
}
}
cin.sync();
cout << "输入还要抽取的次数:" << endl;
trial = getData<unsigned int>(trial, 1);
cin.sync();
cout << "输入想中UP的次数:" << endl;
peach = getData<unsigned int>(peach, 1);
cin.sync();
/*cout << trial << endl;
cout << dian << endl;
system("pause");*/
if (chou == 0) {
for (long times = 0; times < 100000; times++) {
unsigned int favor = 0;
unsigned int big = dian;
unsigned int small = dian;
bool state = baodi_c;
while (big <= dian + trial) {
small++;
big++;
//cout<<small<<" "<<big<<endl;
int res = character::guess(small, state);
//cout<<res<<endl;
if (res == 2) {
state = false;
favor++;
small = 0;
} else if (res == 1) {
state = true;
small = 0;
} //else continue;
}
if (favor >= peach) {
sum++;
}
//cout << "抽中次数:" << favor << endl;
total = total + favor;
}
} else {
for (long times = 0; times < 100000; times++) {
unsigned int favor = 0;
unsigned int big = dian;
unsigned int small = dian;
int state = baodi_w;
while (big <= dian + trial) {
small++;
big++;
//cout<<small<<" "<<big<<endl;
int res = weapon::guess(small, state);
//cout<<res<<endl;
if (res == 2) {
state = 0;
favor++;
small = 0;
} else if (res == 1) {
state++;
small = 0;
} //else continue;
}
if (favor >= peach) {
sum++;
}
//cout << "抽中次数:" << favor << endl;
total = total + favor;
//cout << state << endl;
}
}
double percent = sum / 1000.0;
cout.setf(ios::fixed);
cout << "抽中" << peach << "次以上次数:" << sum << ",概率:" << fixed << setprecision(3) << percent << "%" << endl;
cout << "总次数:" << total << endl;
cin.sync();
cin.get();
return 0;
}