Skip to content

Commit fe7101b

Browse files
committed
Use "int64_t" instead of "long long" in lib/util
1 parent f000c02 commit fe7101b

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

lib/cpalgo/util/bigint.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,9 @@ bigint& bigint::operator*=(const bigint& x) {
151151
negative ^= x.negative;
152152
std::vector<int> c(a.size() * x.a.size() + 1);
153153
for (size_t i = 0; i < a.size(); ++i) {
154-
long long K = 0;
154+
int64_t K = 0;
155155
for (size_t j = 0; j < x.a.size(); ++j) {
156-
long long V = (long long)a[i] * x.a[j] + c[i+j] + K;
156+
int64_t V = (int64_t)a[i] * x.a[j] + c[i+j] + K;
157157
K = V / BASE;
158158
c[i+j] = (int)(V % BASE);
159159
}

lib/cpalgo/util/tests/two_pointers_test.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ TEST(TwoPointersTest, ShouldComputeIntervalCounts) {
88
size_t num_of_call_pre_move_l = 0;
99
size_t num_of_call_pre_move_r = 0;
1010
size_t num_of_call_update = 0;
11-
unsigned long long num_of_intervals = 0;
11+
uint64_t num_of_intervals = 0;
1212
iterate_with_two_pointers(
1313
N,
1414
[&](size_t l, size_t r) {
@@ -28,8 +28,8 @@ TEST(TwoPointersTest, ShouldComputeIntervalCounts) {
2828
EXPECT_EQ(N, num_of_call_pre_move_l);
2929
EXPECT_EQ(N, num_of_call_pre_move_r);
3030
EXPECT_EQ(N, num_of_call_update);
31-
unsigned long long const expect_num_of_intervals =
32-
(unsigned long long)(N) * (N + 1) / 2;
31+
uint64_t const expect_num_of_intervals =
32+
(uint64_t)(N) * (N + 1) / 2;
3333
EXPECT_EQ(expect_num_of_intervals, num_of_intervals);
3434
}
3535

lib/main/util/main-two-pointers.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ using namespace std;
66

77
// Find the smallest sub-array size
88
// where the sum of the sub-array is greater than or equal to S.
9-
size_t solve(vector<int> const& A, long long const S) {
9+
size_t solve(vector<int> const& A, int64_t const S) {
1010
const size_t N = A.size();
11-
long long sum = 0;
11+
int64_t sum = 0;
1212
size_t ans = N + 1;
1313
iterate_with_two_pointers(
1414
N,
@@ -49,7 +49,7 @@ void action_init() {
4949
}
5050

5151
void action_query() {
52-
long long S;
52+
int64_t S;
5353
cin >> S;
5454
cout << solve(buffer, S) << endl;
5555
}

0 commit comments

Comments
 (0)