hdu4252

题目链接:HDU - 4252

据说水,可还是不会。。。。

参考:http://blog.csdn.net/a197p/article/details/45102907

 1 #include<cstdio>
 2 #include<cstring>
 3 #include<iostream>
 4 #include<cmath>
 5 #include<algorithm>
 6 using namespace std;
 7 const int maxn=100010;
 8 int a[maxn];
 9 int main()
10 {
11     int n;
12     int cas=0;
13     while(scanf("%d",&n)!=EOF)
14     {
15         int ans=n,k=0;
16         for(int i=0;i<n;i++)
17         {
18             scanf("%d",&a[i]);
19             if(a[i]==0) {ans--;k=i;}
20             for(int j=i-1;j>=k;j--)
21             {
22                 if(a[i]>a[j]) break;
23                 if(a[i]==a[j]) {ans--;break;}
24             }
25         }
26         printf("Case %d: ",++cas);
27         printf("%d\n",ans);
28     }
29 }
时间: 2024-10-14 00:51:57

hdu4252的相关文章

HDU4252 A Famous City

题解: set 此题关键是理解题意 题意链接:http://blog.csdn.net/luyuncheng/article/details/8053971 代码: #include<iostream> #include<cstring> #include<cstdio> #include<algorithm> #include<cmath> #include<map> #include<set> #include<

HDU4252 ACM fighting(单调栈)

Description After Mr. B arrived in Warsaw, he was shocked by the skyscrapers and took several photos. But now when he looks at these photos, he finds in surprise that he isn't able to point out even the number of buildings in it. So he decides to wor