[PHP Basics - Exercises] - 04. Array Indexes
Задача: [PHP Basics - Exercises] - 04. Array Indexes
В Judge: https://judge.softuni.bg/Contests/Practice/Index/240#3
Моят код: http://pastebin.com/YQpFxZxb
Някой би ли могъл да ми каже защо Judge-a ми дава 100 точки, а при мен кода минава с втория тест (ТЕСТ 2):
Parameter name |
Input |
Output |
|
Input (ТЕСТ 2) |
Output |
key-value-pairs |
0 – 5 1 – 6 2 - 7 |
5<br> 6<br> 7<br> |
|
0$$$5 0$$$6 0$$$7 |
7<br> 0<br> 0<br> |
delimiter |
(space)-(space) |
|
$$$ |
||
array-size |
3 |
|
3 |
А с първия тест:
0 – 5
1 – 6
2 - 7
дава странни стойности и съответно грешки, като например (... '0 – 5' (length=7) ):
Len(KeyValuePairs) = 3
' - ' (length=3)
3
array (size=3) 0 => '0 – 5' (length=7) 1 => '1 – 6' (length=7) 2 => '2 - 7' (length=5)
FOR:
0 – 5
( ! ) Notice: Undefined offset: 1 in C:\xampp\htdocs\Projects\PHP_Basics-Exercises\04-Array_Indexes.php on line 32 | ||||
---|---|---|---|---|
Call Stack | ||||
# | Time | Memory | Function | Location |
1 | 0.0010 | 370344 | {main}( ) | ...\04-Array_Indexes.php:0 |
array (size=1)
0 => '0 – 5' (length=7)
1 – 6
( ! ) Notice: Undefined offset: 1 in C:\xampp\htdocs\Projects\PHP_Basics-Exercises\04-Array_Indexes.php on line 32 | ||||
---|---|---|---|---|
Call Stack | ||||
# | Time | Memory | Function | Location |
1 | 0.0010 | 370344 | {main}( ) | ...\04-Array_Indexes.php:0 |
array (size=1)
0 => '1 – 6' (length=7)
2 - 7
array (size=2) 0 => '2' (length=1) 1 => '7' (length=1)
LEN(resultArray) = 5
0
0
7