回答編集履歴

3

訂正

2018/05/07 15:20

投稿

nullpon
nullpon

スコア5737

test CHANGED
@@ -38,11 +38,7 @@
38
38
 
39
39
  if (d != 0) return d;
40
40
 
41
- d = Integer.compare(y, x);
41
+ return Integer.compare(y, x);
42
-
43
- if (d != 0) return d;
44
-
45
- return 0;
46
42
 
47
43
  });
48
44
 

2

訂正

2018/05/07 15:20

投稿

nullpon
nullpon

スコア5737

test CHANGED
@@ -38,11 +38,11 @@
38
38
 
39
39
  if (d != 0) return d;
40
40
 
41
- if (x > y) return -1;
41
+ d = Integer.compare(y, x);
42
42
 
43
- if (x < y) return 1;
43
+ if (d != 0) return d;
44
44
 
45
- return 0;
45
+ return 0;
46
46
 
47
47
  });
48
48
 

1

訂正

2018/05/07 15:07

投稿

nullpon
nullpon

スコア5737

test CHANGED
@@ -38,9 +38,9 @@
38
38
 
39
39
  if (d != 0) return d;
40
40
 
41
- d = x - y;
41
+ if (x > y) return -1;
42
42
 
43
- if (d != 0) return -d;
43
+ if (x < y) return 1;
44
44
 
45
45
  return 0;
46
46