Thursday, March 31, 2016

URI 1007 in C, C++ and in java language || Difference

Main link in URI Online Judge :

Go URI 1007 No Problem

Read four integer values named A, B, C and D. Calculate and print the difference of product A and B by the product of C and D (A * B - C * D).

Input

The input file contains 4 integer values.

Output

Print DIFERENCA (DIFFERENCE in Portuguese) with all the capital letters, according to the following example, with a blank space before and after the equal signal.
Input SamplesOutput Samples
5
6
7
8
DIFERENCA = -26
0
0
7
8
DIFERENCA = -56
5
6
-7
8
DIFERENCA = 86

Solution in C language :

  1. #include<stdio.h>
  2. int main()
  3. {
  4. int a, b, c, d;
  5. scanf("%d%d%d%d", &a, &b, &c, &d);
  6. printf("DIFERENCA = %d\n", a * b - c * d);
  7. return 0;
  8. }
URI Onilne judge solution 1007 in C, C++ execution

Solution in C++ language :

#include<iostream> using namespace std; int main() { int a, b, c, d; cin >> a >> b >> c >> d; cout << "DIFERENCA = " <<a * b - c * d << endl; return 0; }


Solution in Java language : 


  1. import java.util.Scanner;
  2. public class URI_1007 {
  3. public static void main(String[] args) {
  4. Scanner input =new Scanner(System.in);
  5. int a, b, c, d, difference;
  6. a = input.nextInt();
  7. b = input.nextInt();
  8. c = input.nextInt();
  9. d = input.nextInt();
  10. difference = a * b - c * d;
  11. System.out.print("DIFERENCA = "+ difference +"\n");
  12. }
  13. }
URI 1007 in java execution





To solve more problem in URI solution judge of beginner level at a glance , go to :




To download URI many problem in java language in java language :
Go to


URI 1007 in C, C++ and java solution is present here. I think there will be no problem to clear the simple differencial problem. If you face any problem to this, you can send us a comment please. We will help you as we can.







Read More

Wednesday, March 30, 2016

URI 1043 Solution in java language || Triangle

View the main link :
https://www.urionlinejudge.com.br/judge/en/problems/view/1043


URI Online Judge | 1043

Triangle

Adapted by Neilor Tonin, URI  Brazil
Timelimit: 1
Read three point floating values (A, B and C) and verify if is possible to make a triangle with them. If it is possible, calculate the perimeter of the triangle and print the message:

Perimetro = XX.X

If it is not possible, calculate the area of the trapezium which basis A and B and C as height, and print the message:

Area = XX.X


Input

The input file has tree floating point numbers.

Output

Print the result with one digit after the decimal point.
Input SampleOutput Sample
6.0 4.0 2.0Area = 10.0
6.0 4.0 2.1Perimetro = 12.1


URI 1043 Solution in Java language:


package URI_Problems_solution; /** 6.0 4.0 2.0 Area = 10.0 6.0 4.0 2.1 Perimetro = 12.1 */ import java.util.Scanner; public class URI_1043 { public static void main(String[] args) { float A, B, C, areaTraphisium, perimeterTriangle ; Scanner input =new Scanner(System.in); A = input.nextFloat(); B = input.nextFloat(); C = input.nextFloat(); if ((A < (float)(B+C)) && (B < (float)(A+C)) && (C < (float)(B+A))) { //Triangle perimeter = a + b + c; //Traphisium area is = (a + b)*h/2 perimeterTriangle = A + B + C; System.out.printf("Perimetro = %.1f\n",perimeterTriangle); }else { areaTraphisium = ((A + B) * C) / 2; System.out.printf("Area = %.1f\n",areaTraphisium); } } }


Read More

URI 1036 Solution in Java language || Bhaskar's Formula

Go to main link in URI online judge to solve this problem :

GO URI ONLINE JUDGE ---> Problem No : 1036


URI Online Judge | 1036

Bhaskara's Formula

Adapted by Neilor Tonin, URI  Brazil
Timelimit: 1
Read 3 floating-point numbers. After, print the roots of bhaskara’s formula. If it's impossible to calculate the roots because a division by zero or a square root of a negative number, presents the message “Impossivel calcular”.

Input

Read 3 floating-point numbers A, B and C.

Output

Print the result with 5 digits after the decimal point or the message if it is impossible to calculate.
Input SamplesOutput Samples
10.0 20.1 5.1R1 = -0.29788
R2 = -1.71212
0.0 20.0 5.0Impossivel calcular
10.3 203.0 5.0R1 = -0.02466
R2 = -19.68408
10.0 3.0 5.0Impossivel calcular

URI 1036 Solution in java language:


import java.util.Scanner; //Problem public class URI_1036 { public static void main(String[] args) { float A, B, C, R1, R2; Scanner input =new Scanner(System.in); A = input.nextFloat(); B = input.nextFloat(); C = input.nextFloat(); if ((A == 0) || (((B*B) -(4*A*C)) < 0)) { System.out.print("Impossivel calcular\n"); }else { R1 =(float) ((-B + Math.sqrt(((B*B) -(4*A*C)))) / (2*A)); R2 =(float) ((-B - Math.sqrt(((B*B) -(4*A*C)))) / (2*A)); System.out.printf("R1 = %.5f\n", R1); System.out.printf("R2 = %.5f\n", R2); } } }

For any problem in this problem , comment please. I'll help as I can.

See other solution in java , C, C++ language :

Go to Home








Read More

All rights reserved ©2016 -URI ONLINE JUDGE SOLUTION | Developed by Maniruzzaman Akash

© 2016 URI ONLINE JUDGE SOLUTION. Developed by Maniruzzaman Akash | Distributed By Gooyaabi Templates
Powered by Blogger.