回答編集履歴
1
追記
test
CHANGED
@@ -11,3 +11,31 @@
|
|
11
11
|
|
12
12
|
|
13
13
|
で作れるのかな?
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
---
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
絶対値を求める関数ABS()を作れるとすれば,以下のような感じでやれる.
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
```
|
26
|
+
|
27
|
+
IsOtherBuilding = ABS( num - numb ); //棟が違えば1, 同じなら0
|
28
|
+
|
29
|
+
IsSameBuilding = 1 - IsOtherBuilding;
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
Ans1 = ABS( num1 - numb1 ); //棟が同じ場合の答え
|
34
|
+
|
35
|
+
Ans2 = ABS( num1 + numb1 ); //棟が異なる場合の答え
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
Ans = IsSameBuilding*Ans1 + IsOtherBuilding*Ans2; //最終的な答え
|
40
|
+
|
41
|
+
```
|