1 #include<cstdio>
 2 #define MAXN 100010
 3 int st[MAXN];
 4 int main()
 5 {
 6     bool flag;
 7     int n,i,x,top,ans,ca=1;
 8     while(~scanf("%d",&n))
 9     {
10         for(top=-1,ans=i=0;i<n;i++)
11         {
12             flag=true;
13             scanf("%d",&x);
14             for(;top>-1&&st[top]>=x;top--)
15             {
16                 if(st[top]==x)
17                     flag=false;
18             }
19             st[++top]=x;
20             if(flag&&x)
21                 ans++;
22         }
23         printf("Case %d: %d\n",ca++,ans);
24     }
25     return 0;
26 }
posted on 2012-07-19 19:39  DrunBee  阅读(219)  评论(0编辑  收藏  举报