2021-10-10 23:45:47 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
|
|
static inline int intmin(int x, int y) {
|
|
|
|
return x < y ? x : y;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int intmax(int x, int y) {
|
|
|
|
return x > y ? x : y;
|
|
|
|
}
|
2021-10-22 00:28:13 +08:00
|
|
|
|
|
|
|
static inline int intmin3(int x, int y, int z) {
|
|
|
|
if (x < y)
|
|
|
|
if (x < z)
|
|
|
|
return x;
|
|
|
|
else
|
|
|
|
return z;
|
|
|
|
else if (y < z)
|
|
|
|
return y;
|
|
|
|
else
|
|
|
|
return z;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int intmax3(int x, int y, int z) {
|
|
|
|
if (x > y)
|
|
|
|
if (x > z)
|
|
|
|
return x;
|
|
|
|
else
|
|
|
|
return z;
|
|
|
|
else if (y > z)
|
|
|
|
return y;
|
|
|
|
else
|
|
|
|
return z;
|
|
|
|
}
|