Skip to main content

Posts

Showing posts from 2016

URI Online Judge problem 1037 solved

URI Online Judge | 1037 Interval Adapted by Neilor Tonin, URI   Brazil Timelimit: 1 You must make a program that read a float-point number and print a message saying in which of following intervals the number belongs: [0,25] (25,50], (50,75], (75,100]. If the read number is less than zero or greather than 100, the program must print the message “Fora de intervalo” that means "Out of Interval". The symbol '(' represents greather than. For example: [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. Input Sample Output Sample 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 problem 1064 solved

URI Online Judge | 1064 Positives and Average Adapted by Neilor Tonin, URI   Brazil Timelimit: 1 Read 6 values that can be floating point numbers. After, print how many of them were positive. In the next line, print the average of all positive values typed, with one digit after the decimal point. Input The input consist in 6 numbers that can be integer or floating point values. At least one number will be positive. Output The   first   output value   is the amount of   positive numbers.   The next   line should show   the average of  the  positive values   ​typed. Input Sample Output Sample 7 -5 6 -3.4 4.6 12 4 valores positivos 7.4                                                                        #include<st...

URI Online Judge problem 1042 solved

URI Online Judge | 1042 Simple Sort Adapted by Neilor Tonin, URI   Brazil Timelimit: 1 Read three integers and sort them in ascending order. After, print these values in ascending order, a blank line and then the values in the sequence as they were readed. Input The input contains three integer numbers. Output Present the output as requested above. Input Sample Output Sample 7 21 -14 -14 7 21 7 21 -14 -14 21 7 -14 7 21 -14 21 7                     #include<stdio.h> int main(void){     int a,b,c;     while(scanf("%d%d%d",&a,&b,&c)==3){         if(a>=b && a>=c && b>=c)             printf("%d\n%d\n%d\n\n%d\n%d\n%d\n",c,b,a,a,b,c);         else if(a>=b && a>=c && c>=b)             printf("%d\n%d\n%d...

URI Online Judge problem 1040 solved

URI Online Judge | 1040 Average 3 Adapted by Neilor Tonin, URI   Brazil Timelimit: 1 Read four numbers (N 1 , N 2 , N 3 , N 4 ), which one with 1 digit after the decimal point, corresponding to 4 scores obtained by a student. Calculate the average with weights 2, 3, 4 e 1 respectively, for these 4 scores and print the message  "Media: "  (Average), followed by the calculated result. If the average was 7.0 or more, print the message  "Aluno aprovado."  (Approved Student). If the average was less than 5.0, print the message:  "Aluno reprovado." (Reproved Student). If the average was between 5.0 and 6.9, including these, the program must print the message "Aluno em exame." (In exam student). In case of exam, read one more score. Print the message  "Nota do exame: "  (Exam score) followed by the typed score. Recalculate the average (sum the exam score with the previous calculated average and divide by 2) and print the message  “...