---
# System prepended metadata

title: 高科大智慧商務系 程式設計模擬段考

---

# 高科大智慧商務系 程式設計模擬段考

## :memo: 程式碼題解


#### 三角形階層
``` python=1
t=int(input())
for i in range(1,t+1):
    s=i
    for j in range(i):
        print(s,end=" ")
        s+=i
    print()
```    
#### 電費
```python=1
t=int(input())
#夏月
s=0
#非夏月
s1=0
if t<121:
    s=t*2.1
    s1=t*2.1
elif t<331:
    s=120*2.1+(t-120)*3.02
    s1=120*2.1+(t-120)*2.68
elif t<501:
    s=120*2.1+(330-120)*3.02+(t-330)*4.39
    s1=120*2.1+(330-120)*2.68+(t-330)*3.61
elif t<701:
    s=120*2.1+(330-120)*3.02+(500-330)*4.39+(t-500)*4.97
    s1=120*2.1+(330-120)*2.68+(500-330)*3.61+(t-500)*4.01
else:
    s=120*2.1+(330-120)*3.02+(500-330)*4.39+(700-500)*4.97+(t-700)*5.63
    s1=120*2.1+(330-120)*2.68+(500-330)*3.61+(700-500)*4.01+(t-700)*4.5
print("夏日電費%.2f"%(s))
print("非夏日電費%.2f"%(s1))
```
#### 迴文
```python=1
t=input("輸入一字元為:")
if t==t[::-1]:
    print("YES")
else:
    print("NO")
```

#### 撲克牌
``` python=1
list1=input().split()
dict1={"A":1,"J":11,"Q":12,"K":13}
t=0
for i in list1:
    if i.isdigit(): #判斷整數
        t+=int(i)
    else:
        t+=dict1[i]
print(t)
```
#### 計程車車資
```python=1

t=eval(input("請輸入路程公里數(km):"))
s=75
if t>1.5:
    t-=1.5
    s+=(t//0.25)*5
    if t%0.25!=0:
        s+=5
print("所需車資為:%d"%(int(s)))