質問編集履歴

3

文法の修正

2019/04/12 05:35

投稿

norikr
norikr

スコア10

test CHANGED
File without changes
test CHANGED
@@ -72,7 +72,65 @@
72
72
 
73
73
  ```php
74
74
 
75
+ public function getBillCount(int $bill): ?array
76
+
77
+ {
78
+
79
+ $count_1 = $bill%5;
80
+
81
+ $count_5 = floor(($bill%10)/5);
82
+
83
+ $count_10 = floor(($bill%50)/10);
84
+
85
+ $count_50 = floor(($bill%100)/50);
86
+
87
+ $count_100 = floor(($bill%500)/100);
88
+
89
+ $count_500 = floor(($bill%1000)/500);
90
+
91
+ $count_1000 = floor(($bill%5000)/1000);
92
+
93
+ $count_5000 = floor(($bill%10000)/5000);
94
+
95
+ $count_10000 = floor($bill/10000);
96
+
97
+
98
+
99
+ $num = array (
100
+
101
+ "1" => $count_1,
102
+
103
+ "5" => $count_5,
104
+
105
+ "10" => $count_10,
106
+
107
+ "50" => $count_50,
108
+
109
+ "100" => $count_100,
110
+
111
+ "500" => $count_500,
112
+
113
+ "1000" => $count_1000,
114
+
115
+ "5000" => $count_5000,
116
+
117
+ "10000" => $count_10000,
118
+
119
+ );
120
+
121
+
122
+
123
+ return $num;
124
+
125
+ }
126
+
127
+
128
+
129
+ public function testGetBillCount_0枚有り()
130
+
131
+ {
132
+
75
- if ($count_1=$count_5=$count_10=$count_50=$count_100=$count_500=$count_1000=$count_5000=$count_10000 !== 0) {
133
+ if ($count_1=$count_5=$count_10=$count_50=$count_100=$count_500=$count_1000=$count_5000=$count_10000 !== 0) {
76
134
 
77
135
  $num = array (
78
136
 
@@ -96,6 +154,10 @@
96
154
 
97
155
  );
98
156
 
157
+ }
158
+
159
+
160
+
99
161
  ```
100
162
 
101
163
 

2

code機能の利用

2019/04/12 05:35

投稿

norikr
norikr

スコア10

test CHANGED
File without changes
test CHANGED
@@ -70,6 +70,8 @@
70
70
 
71
71
 
72
72
 
73
+ ```php
74
+
73
75
  if ($count_1=$count_5=$count_10=$count_50=$count_100=$count_500=$count_1000=$count_5000=$count_10000 !== 0) {
74
76
 
75
77
  $num = array (
@@ -94,6 +96,8 @@
94
96
 
95
97
  );
96
98
 
99
+ ```
100
+
97
101
 
98
102
 
99
103
 

1

書式の改善

2019/04/12 05:30

投稿

norikr
norikr

スコア10

test CHANGED
File without changes
test CHANGED
@@ -12,15 +12,15 @@
12
12
 
13
13
 
14
14
 
15
- **Q.
15
+ **Q.**
16
16
 
17
- 入力された値から、各硬貨・紙幣の枚数を配列に格納する。
17
+ **入力された値から、各硬貨・紙幣の枚数を配列に格納する。**
18
18
 
19
- 配列の内容は、硬貨・紙幣の金額をKeyにして枚数を値にする。
19
+ **配列の内容は、硬貨・紙幣の金額をKeyにして枚数を値にする。**
20
20
 
21
- 枚数が0枚のものは、配列に格納しない。
21
+ **枚数が0枚のものは、配列に格納しない。**
22
22
 
23
- また、配列には金額の小さいものから順に並んでいる必要がある。**
23
+ **また、配列には金額の小さいものから順に並んでいる必要がある。**
24
24
 
25
25
 
26
26