輸入請用"input"表示,若有兩個以上輸入請標明"input1"、"input2"等,如:var_a=input1
"input"可無限使用,且值固定
output請使用print輸出
可使用程式碼片段請參考程式碼碎片清單
請注意!Compiler 實際測試時使用的輸入和題目範例不同,請依照範例找出輸入和輸出之間的規律,並編寫通用的解題程式
解題方式請參考「解題範例」
1.
input | ouput |
1 | 4 |
2 | 7 |
5 | 28 |
-9 | -9 |
0 | 3 |
-7 | -7 |
2.
input | ouput |
[4,1,2] | 0 1 2 |
[0,2,5] | 0 1 2 3 4 5 |
[3] | 0 1 2 3 |
[0,1] | 0 1 |
[5,2,3] | 0 1 2 3 |
3.
input | ouput |
2 | 1 |
1024 | 10 |
64 | 6 |
16 | 4 |
4.
input1 | input2 | ouput |
5 | [-3, -5 ,-9 ,-2,-99] | -2 |
1 | [1] | 1 |
7 | [1,2,3,4,5,6,7] | 7 |
4 | [-2,3,1,0] | 3 |
2 | [0,5] | 5 |
5.
input1 | input2 | ouput |
5 | [1,5,7,3,2] | [2,1,5,7,3] |
1 | [3] | [3] |
3 | [1,9,7] | [7,1,9] |