BestCoder Round #50 (div.1) 1001 Distribution money (HDU OJ 5364)

题目:Click here

题意:bestcoder上面有中文题目

 1 #include <iostream>
 2 #include <cstdio>
 3 #include <cstring> 
 4 #include <algorithm>
 5 #include <cmath>
 6 #include <string> 
 7 #include <climits>
 8 #include <vector> 
 9 #include <queue>
10 #include <stack>
11 #define F first
12 #define S second
13 typedef long long ll;
14 using namespace std;
15 const double PI = 3.14159265;
16 const double E = 2.718281828459;
17 const double EPS=1e-8;
18 const int M = 1e5+5;
19 const int MOD = 1e9+7;
20 const int INF = 0x3f3f3f3f;
21 
22 int n;
23 int a[M];
24 int main()  {
25     #ifdef ONLINE_JUDGE
26     #else
27         freopen( "in.txt", "r", stdin );
28     #endif
29     while( ~scanf("%d", &n ) )  {
30         memset( a, 0, sizeof(a) );
31         for( int i=0; i<n; i++ )    {
32             int x;
33             scanf("%d", &x );
34             a[x]++;
35         }
36         bool ok = true;
37         bool first = true;
38         for( int i=0; i<=1e5; i++ ) {
39             if( a[i] > n-a[i] )  {
40                 if( first ) {
41                     ok = false;
42                     first = false;
43                     printf("%d", i );
44                 }
45                 else    {
46                     printf(" %d", i );
47                 }
48             }
49         }
50         if( ok )
51             printf("-1");
52         printf("\n");
53     }
54     return 0;
55 }

 

转载于:https://www.cnblogs.com/TaoTaoCome/p/4714759.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值