teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

4

追記

2018/03/26 17:34

投稿

LouiS0616
LouiS0616

スコア35676

answer CHANGED
@@ -5,6 +5,7 @@
5
5
  class Main {
6
6
  static int convertToInt(String src) {
7
7
  String[] nums = src.split(" ");
8
+ // return 100 * Integer.parseInt(nums[0]) + Integer.parseInt(nums[1]); でも可
8
9
  return Integer.parseInt(
9
10
  String.format("%s%02d", nums[0], Integer.parseInt(nums[1]))
10
11
  );

3

修正

2018/03/26 17:34

投稿

LouiS0616
LouiS0616

スコア35676

answer CHANGED
@@ -20,18 +20,36 @@
20
20
  if(base > input) {
21
21
  System.out.println("負け");
22
22
  }
23
- else {
23
+ else if(base < input) {
24
24
  System.out.println("勝ち");
25
25
  }
26
+ else {
27
+ System.out.println("エラー");
28
+ }
26
29
  }
27
30
  }
28
31
  }
29
32
  }
30
33
  ```
31
34
 
32
- **実行結果** [Wandbox](https://wandbox.org/permlink/FJn9JkMHISCHxbL8)
35
+ **入力例**
33
36
  ```
37
+ 5 1
38
+ 6
39
+ 1 0
40
+ 6 2
41
+ 5 0
42
+ 5 1
43
+ 15 3
44
+ 3 35
45
+ ```
46
+
47
+ **実行結果** [Wandbox](https://wandbox.org/permlink/VELgDv2rY1cf3i1C)
48
+ ```
34
49
  負け
35
50
  勝ち
36
51
  負け
52
+ エラー
53
+ 勝ち
54
+ 負け
37
55
  ```

2

修正

2018/03/26 09:41

投稿

LouiS0616
LouiS0616

スコア35676

answer CHANGED
File without changes

1

追記

2018/03/26 09:40

投稿

LouiS0616
LouiS0616

スコア35676

answer CHANGED
@@ -27,4 +27,11 @@
27
27
  }
28
28
  }
29
29
  }
30
+ ```
31
+
32
+ **実行結果** [Wandbox](https://wandbox.org/permlink/FJn9JkMHISCHxbL8)
33
+ ```
34
+ 負け
35
+ 勝ち
36
+ 負け
30
37
  ```