[Codeforces Round #165 (Div. 2)]B. Multithreading

地址:http://codeforces.com/contest/270/problem/B

更新的数字会上浮,从后往前找降序子串,这就是没有更新的,从而得到更新的数量

 1 #include <iostream>
 2 using namespace std;
 3 
 4 int n,a[100000];
 5 
 6 int main()
 7 {
 8     ios::sync_with_stdio(false);
 9     int con=1;
10     cin>>n;
11     for(int i=0;i<n;i++)
12     {
13         cin>>a[i];
14     }
15     for(int i=n-1;i>=1;i--)
16     {
17         if(a[i-1]<a[i]) con++;
18         else break;
19     }
20     cout<<n-con<<endl;
21     return 0;
22 }

 

posted @ 2013-02-02 21:42  tjsuhst  阅读(163)  评论(0编辑  收藏  举报