Posts

URI Online Judge | 1037 Interval (Solution)

Image
Problem Link: https://www.urionlinejudge.com.br/judge/en/problems/view/1037 URI Online Judge | 1037 Interval Adapted by Neilor Tonin, URI   Brazil Timelimit: 1 The input file contain a float-point number. Your task is to print a message saying in which of following intervals the number belongs: [0,25] (25,50], (50,75], (75,100]. If the input is less than zero or greather than 100, the program must print the message “Fora de intervalo” that means "Out of Interval". Examples: [0,25] indicates numbers between 0 and 25.0000, including both. (25,50] indicates numbers greather than 25 (25.00001) up to 50.0000000. Input The input file contains a floating-point number. Output The output must be a message like following example. Sample Input Sample Output 25.01 Intervalo (25,50] 25.00 Intervalo [0,25] 100.00 Intervalo (75,100] -25.02 Fora de intervalo Solution: #include<stdio.h> int main() {      double n;...

URI Online Judge | 1036 Bhaskara's Formula (Solution)

Image
Problem Link: https://www.urionlinejudge.com.br/judge/en/problems/view/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 was 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. Sample Inputs Sample Outputs 10.0 20.1 5.1 R1 = -0.29788 R2 = -1.71212 0.0 20.0 5.0 Impossivel calcular 10.3 203.0 5.0 R1 = -0.02466 R2 = -19.68408 10.0 3.0 5.0 Impossivel calcular Solution: #include<stdio.h> #include<math.h> int main() {      double a,b,c,r1,r2,del;      scanf ( "%lf %lf %lf" ,&a,&b,&c);...