URI-1010 Solve

Simple Calculate

Adapted by Neilor Tonin, URI  Brazil
Timelimit: 1
In this problem, the task is to read a code of a product 1, the number of units of product 1, the price for one unit of product 1, the code of a product 2, the number of units of product 2 and the price for one unit of product 2. After this, calculate and show the amount to be paid.

Input

The input file contains two lines of data. In each line there will be 3 values: two integers and a floating value with 2 digits after the decimal point.

Output

The output file must be a message like the following example where "Valor a pagar" means Value to Pay. Remember the space after ":" and after "R$" symbol. The value must be presented with 2 digits after the point.
Input SamplesOutput Samples
12 1 5.30
16 2 5.10
VALOR A PAGAR: R$ 15.50
13 2 15.30
161 4 5.20
VALOR A PAGAR: R$ 51.40
1 1 15.10
2 1 15.10
VALOR A PAGAR: R$ 30.20
Problem link: https://www.urionlinejudge.com.br/judge/en/problems/view/1010

Solution:

  • [tab]
    • C
      • #include<stdio.h>
        int main(void){
            int a,b,x,y;
            double m,n,result;
            scanf("%d%d%lf",&a,&b,&m);
            scanf("%d%d%lf",&x,&y,&n);
            result=(double)b*m+(double)y*n;
            printf("VALOR A PAGAR: R$ %.2lf\n",result); 
            return 0;
        }
    • C++
      • #include <cstdio>
        using namespace std;
        
        int main(int argc, char const *argv[])
        {
         int a, b;
         double c, res;
        
         scanf("%d %d %lf", &a, &b, &c);
         res = b * c;
         scanf("%d %d %lf", &a, &b, &c);
         res += b * c;
         printf("VALOR A PAGAR: R$ %.2lf\n", res);
        
         return 0;
        }
3/Technology/post-list
Name

Codeforces,53,Problem Solve,90,Programming Tricks,1,URI,37,
ltr
item
DorHubs: URI-1010 Solve
URI-1010 Solve
https://resources.urionlinejudge.com.br/gallery/images/flags/br.gif
DorHubs
https://dorhubs.blogspot.com/2019/08/uri-1010-solve.html
https://dorhubs.blogspot.com/
https://dorhubs.blogspot.com/
https://dorhubs.blogspot.com/2019/08/uri-1010-solve.html
true
9087637800571592252
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy