HDU1303+水

水题不解释。。。

View Code
 1 /*
 2 简单题
 3 */
 4 #include<stdio.h>
 5 #include<string.h>
 6 #include<stdlib.h>
 7 #include<algorithm>
 8 #include<iostream>
 9 #include<queue>
10 #include<vector>
11 #include<map>
12 #include<math.h>
13 typedef long long ll;
14 //typedef __int64 int64;
15 const int maxn = 205;
16 const int maxm = 1005;
17 const int inf = 0x7FFFFFFF;
18 const double pi = acos(-1.0);
19 const double eps = 1e-8;
20 using namespace std;
21 
22 int vis[ maxn ];
23 int a[ maxn ];
24 
25 int main(){
26     int n;
27     while( scanf("%d",&n)==1 ){
28         if( n==-1 ) break;
29         int cnt = 0;
30         a[ cnt++ ] = n;
31         memset( vis,0,sizeof( vis ) );
32         vis[ n ] = 1;
33         while( scanf("%d",&n)==1 ){
34             if( n==0 ) break;
35             a[ cnt++ ] = n;
36             vis[ n ] = 1;
37         }
38         int res = 0;
39         sort( a,a+cnt );
40         for( int i=cnt-1;i>=0;i-- ){
41             if( a[i]%2==0 ){
42                 if( vis[ a[i]/2 ]==1 ) res++;
43             }
44         }
45         printf("%d\n",res);
46     }
47     return 0;
48 }
keep moving...
原文地址:https://www.cnblogs.com/xxx0624/p/3059643.html