Snack beeCrowd 1038 URI solution C Python problem solved bee neilor tonin brazil list uri judge language printf print stdio.h input scanf % x y count
Snack
The formula is:
- Take input.
- Create a list of prices. This list will contain the prices for the items.
- Now using (X-1) as an index get the prices of items and multiply them by Y.
- Print the value.
The solution in C:
#include <stdio.h>
int main() {
int x,y;
scanf("%d %d",&x,&y);
double prices[5] = {4.00,4.50,5.00,2.00,1.50};
double total = prices[x-1]*y;
printf("Total: R$ %0.2f\n",total);
return 0;
}
The solution in Python:
x, y = map(int, input().split())
prices = [4.00,4.50,5.00,2.00,1.50]
total = prices[x-1]*y;
print("Total: R$ %0.2f"%total);
COMMENTS