-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlab_00_A.cpp
70 lines (57 loc) · 1.37 KB
/
lab_00_A.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
// SPDX-License-Identifier: AGPL-3.0-or-later
/*
CS203_DSAA_template
Copyright (C) 2020-2023 nanoseeds
*/
#include <tuple>
#include <vector>
#include <iostream>
#ifdef CS203_DSAA_TEST_MACRO
namespace lab_00_A{
#endif
using std::tie;
using std::cin;
using std::cout;
using std::tuple;
using std::vector;
static constexpr const char end{'\n'};
using num_t = int32_t;
using input_type = tuple<num_t, num_t>;
using output_type = num_t;
inline input_type read();
output_type cal(const input_type& data);
void output(const output_type &data);
int main() {
auto input_data = read();
auto output_data = cal(input_data);
output(output_data);
return 0;
}
inline input_type read() {
num_t a{0}, b{0};
std::cin >> a >> b;
return std::make_tuple(a, b);
}
output_type cal(const input_type& data) {
num_t a{0}, b{0};
tie(a, b) = data;
num_t c = a + b;
return c;
}
void output(const output_type &data) {
std::cout << data << end;
}
static const auto faster_streams = [] {
srand(time(nullptr));
// use time to init the random seed
std::ios::sync_with_stdio(false);
std::istream::sync_with_stdio(false);
std::ostream::sync_with_stdio(false);
std::cin.tie(nullptr);
std::cout.tie(nullptr);
// 关闭c++风格输入输出 , 与C风格输入输出的同步,提高性能.
return 0;
}();
#ifdef CS203_DSAA_TEST_MACRO
}
#endif