-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
75 lines (68 loc) · 1.82 KB
/
main.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
#include <iostream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
int total_air;
//
class Fraction {
private:
int fenZi;
int fenMu;
public:
Fraction(int zi, int mu) : fenZi(zi), fenMu(mu) {}
//转换函数
operator double() const { return double(fenZi) / double(fenMu); }
};
//测试
int main() {
Fraction f(3, 5);
double d = 4 + f;
cout << "d = " << d << endl;
return 0;
}
// void recover(unordered_map<int, unordered_map<int, int>> &paths, unordered_set<int> &idols, int &air, int
// start_point,
// int &cur, int &ans) {
// // 返回时更新
// if (air <= 0) {
// cur = 0;
// air = total_air;
// return;
// }
// if (!paths.count(start_point)) return;
// for (auto &elem : paths[start_point]) {
// if (air >= 2 * elem.second && idols.count(elem.first)) ++cur;
// ans = cur > ans ? cur : ans;
// air -= 2 * elem.second;
// recover(paths, idols, air, elem.first, cur, ans);
// }
// }
// int total;
// int points, tunnels;
// int start, end, air;
// int idol_num, idol_tmp;
// cin >> total;
// while (total) {
// cin >> points >> tunnels;
// unordered_map<int, unordered_map<int, int>> paths;
// for (int i = 0; i != tunnels; ++i) {
// cin >> start >> end >> air;
// paths[start].insert({end, air});
// }
// cin >> idol_num;
// unordered_set<int> idols(idol_num);
// for (int i = 0; i != idol_num; ++i) {
// cin >> idol_tmp;
// idols.insert(idol_tmp);
// }
// cin >> total_air;
// auto tmp_air = total_air;
// // 处理完输入
// int ans = 0, cur = 0;
// recover(paths, idols, tmp_air, 0, cur, ans);
// cout << ans << endl;
// // 处理下一组输入
// --total;
// }