generated from projeto-de-algoritmos/RepositorioTemplate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
best_order.c
44 lines (35 loc) · 983 Bytes
/
best_order.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
* - Problema: Best Order, URI 2919 - https://www.urionlinejudge.com.br/judge/en/problems/view/2919
* - Codigo por: © Erick Giffoni e Elias Bernardo
* - Universidade de Brasilia, 2020
*
*/
#include <stdio.h>
#include <stdlib.h>
#define type float
int main(){
type n;
while(scanf(" %f", &n)!=EOF){
type * numbers = (type *) calloc(n, sizeof(type));
type * list = (type *) calloc(n, sizeof(type));
for(int i=0; i<n; i++){
scanf(" %f", &numbers[i]);
}
for(int j=0; j<n; j++){
list[j] = 1;
for(int i=0; i<j; i++){
if(numbers[i] < numbers[j] && 1+list[i] > list[j]){
list[j] = 1+list[i];
}
}
}
type bigger = 0;
for(int i=0; i<n; i++){
if(bigger < list[i]){
bigger = list[i];
}
}
printf("%.0f\n", bigger);
}
return 0;
}