5 条题解
-
0
是这样的
#include using namespace std; int a[10005]; int main() { ios::syne_with_stdio(false); cout.tie(0); cin.tie(0); int x; cin>>x; int res=1; a[res]=x; while(cin>>x) { sort(a+1,a+res); if(a[res]<x) { res++; a[res]=x; } else a[lower_bound(a+1,a+res,x)-a]=x; } cout<<res;
-
0
#include<stdio.h> const int N = 10000; int sum = 0, i = 0, n = 0, m; void sort(int b[], int n) { int x; for(int j = 0 ; j < n - 1 ; j ++) { int m = b[j]; for(int k = j + 1 ; k < n ; k ++) { if(m >= b[k]) { m = b[k]; x = k; } } b[x] = b[j]; b[j] = m; } } int fun(int x, int b[], int n) { if(n == 0) b[n] = x; for(int j = 0 ; j < n ; j ++) { if(b[j] >= x) { b[j] = x; return 0; } } b[n] = x; return 1; } int main() { int a[N], b[N]; while(scanf("%d",&m)!=EOF) { a[i] = m; i ++; n ++; } i = 0; for(int j = 1 ; j < n ; j ++) { if(fun(a[j], b, i)) sum ++; i ++; sort(b,i); } printf("%d",sum); }
- 1
信息
- ID
- 881
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 9
- 标签
- 递交数
- 110
- 已通过
- 17
- 上传者