We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 08e3b45 commit 7600ac6Copy full SHA for 7600ac6
C++/chapImplement.tex
@@ -38,21 +38,21 @@ \subsubsection{代码}
38
public:
39
int reverse (int x) {
40
long long r = 0;
41
- long long t = x;
42
- t = t > 0 ? t : -t;
+ long long t = x;
+ t = t > 0 ? t : -t;
43
for (; t; t /= 10)
44
r = r * 10 + t % 10;
45
46
- bool sign = x > 0 ? false: true;
47
- if (r > 2147483647 || (sign && r > 2147483648)) {
48
- return 0;
49
- } else {
50
- if (sign) {
51
- return -r;
52
53
- return r;
54
- }
55
+ bool sign = x > 0 ? false: true;
+ if (r > 2147483647 || (sign && r > 2147483648)) {
+ return 0;
+ } else {
+ if (sign) {
+ return -r;
+ return r;
+ }
56
}
57
};
58
\end{Code}
0 commit comments