Skip to content

Commit 3eff82f

Browse files
committed
opt code
1 parent 423bb1d commit 3eff82f

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

src/ch01/0302.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
1-
#include <ctime>
1+
#include <ctime> // using srand()
22
const int64 MAXN = 105;
33
int64 gcd(int64 a, int64 b)
44
{
55
if (a == 0) return 1;
6-
if (a < 0) return gcd(-a, b);
7-
while (b)
8-
{
9-
int64 t = a; a = b; b = t % b;
10-
}
11-
return a;
12-
6+
if (a < 0) return __gcd(-a, b);
7+
return __gcd(a, b);
138
}
149

1510
int64 mul_mod(int64 a, int64 b, int64 m)

src/ch01/0401.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
const double eps = 1e-15;
22
inline bool test(double x)
33
{
4-
// true : l = mid
5-
// false: r = mid
4+
// true : l = mid, false: r = mid
65
/**Specific Calculation**/
76
}
87
double Bsearch(double l, double r)

0 commit comments

Comments
 (0)