-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExpenses.py
More file actions
35 lines (31 loc) · 773 Bytes
/
Expenses.py
File metadata and controls
35 lines (31 loc) · 773 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#Q. 9:
#Expenses(Input and Output)
#While purchasing certain items, a discount of 10% is offered if the quantity purchased is more than 1000.
#If the quantity and price per item are input, write a program to calculate the total expenses.
#Input
#The first line contains an integer T, total number of test cases. Then follow T lines, each line contains integers quantity and price.
#Output
#Output the total expenses while purchasing items.
#Constraints
#1<=T<=1000
#1<=quantity, price <=100000
#Example
#Input
#3
#100 120
#10 20
#1200 20
#Output
#12000.000000
#200.000000
#21600.000000
T = int(input())
for i in range(T):
X = input().split()
Q = int(X[0])
P = int(X[1])
F = Q * P
if Q > 1000:
N = F * 0.1
F = F - N
print('%0.6f'%float(F))