2015icpc北京区域赛的签到题
还是很签到的 一次就过了
题意呢
就是统计B C后最长上升序列还有S的个数
当然B C要被S分割开……
1 /* *********************************************** 2 Author :Sun Yuefeng 3 Created Time :2016/10/16 18:41:24 4 File Name :A.cpp 5 ************************************************ */ 6 7 #include<cstdio> 8 #include<iostream> 9 #include<algorithm> 10 #include<cmath> 11 #include<cstring> 12 #include<string> 13 #include<bitset> 14 #include<map> 15 #include<set> 16 #include<stack> 17 #include<vector> 18 #include<queue> 19 #include<list> 20 #define M(a,b) memset(a,b,sizeof(a)) 21 using namespace std; 22 typedef long long ll; 23 const int inf=0x3f3f3f3f; 24 const int maxn=1e9+10; 25 const int mod=1e7+7; 26 int dx[8]= {0,0,1,-1,1,-1,1,-1}; 27 int dy[8]= {1,-1,0,0,-1,1,1,-1}; 28 29 int main() 30 { 31 //freopen("in.txt","r",stdin); 32 //freopen("out.txt","w",stdout); 33 int n; 34 while(~scanf("%d",&n)){ 35 int ans=0,last=-1; 36 while(n--){ 37 char a; 38 cin>>a; 39 if(a=='S'){ 40 ans++; 41 last=-1; 42 } 43 else{ 44 int a; 45 scanf("%d",&a); 46 if(a>last){ 47 if(last==-1) ans++; 48 last=a; 49 } 50 else{ 51 last=a; 52 ans++; 53 } 54 } 55 } 56 printf("%d ",ans); 57 } 58 return 0; 59 }