編寫一個Python程序,接受用戶輸入矩形邊長,並計算輸出矩形面積。
一行輸入兩個正整數 a, b 作為矩形的長和寬,數值之間以一個空白鍵分隔
a, b < 100,000
矩形面積
5 2
10
6 2
12
In the online judge system, the inputs come from "standard input". To read the data from standard input, we can use a function called "input()".
>>in_line = input()
[Note 1]However, the input() function will only give you one single line of input (from standard input). To split the data from a single line, we need a function called "split()" to help.
>> inputs = in_line.split()
>> print(inputs[0], inputs[1])
[Note 2]Even we have successfully split the data, the data is still in "string" format. To do our math calculation, we need to convert the string into integer by a function called "int()".
>>a = int(inputs[0])
>> b = int(inputs[1])
ID | User | Problem | Subject | Hit | Post Date |
沒有發現任何「解題報告」 |