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 }
时间: 2024-10-22 04:11:28

BestCoder Round #50 (div.1) 1001 Distribution money (HDU OJ 5364)的相关文章

BestCoder Round #50 (div.2)

题目传送:BestCoder Round #50 (div.2) BC感觉越做越无语了 1001.Distribution money AC代码: #include <map> #include <set> #include <list> #include <cmath> #include <deque> #include <queue> #include <stack> #include <bitset> #

DP BestCoder Round #50 (div.2) 1003 The mook jong

题目传送门 1 /* 2 DP:这题赤裸裸的dp,dp[i][1/0]表示第i块板放木桩和不放木桩的方案数.状态转移方程: 3 dp[i][1] = dp[i-3][1] + dp[i-3][0] + 1; dp[i][0] = dp[i-1][1] + dp[i-1][0]; 4 比赛时二维dp写搓了,主要是边界情况的判断出错,比如dp[3][1] = 1,因为第3块放了木桩,其他地方不能再放,dp[3][0]同理 5 解释一下dp[i][1]的三种情况,可能是前面相隔2个放的方案或者是不放的

计算几何(水)BestCoder Round #50 (div.2) 1002 Run

题目传送门 1 /* 2 好吧,我不是地球人,这题只要判断正方形就行了,正三角形和正五边形和正六边形都不可能(点是整数). 3 但是,如果不是整数,那么该怎么做呢?是否就此开启计算几何专题了呢 4 */ 5 /************************************************ 6 * Author :Running_Time 7 * Created Time :2015-8-8 19:54:14 8 * File Name :B.cpp 9 ************

BestCoder Round #50 (div.2) HDU 5365 Run(简单几何)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5365 题面:(严重吐槽,看着真不舒服,还是改一下吧) Run Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 549    Accepted Submission(s): 245 Problem Description AFA is a g

HDU 5651 xiaoxin juju needs help(BestCoder Round #77 (div.1)1001)

传送门 xiaoxin juju needs help Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 861    Accepted Submission(s): 243 Problem Description As we all known, xiaoxin is a brilliant coder. He knew **palin

ACM学习历程—HDU5585 Numbers(数论 || 大数)(BestCoder Round #64 (div.2) 1001)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5585 题目大意就是求大数是否能被2,3,5整除. 我直接上了Java大数,不过可以对末尾来判断2和5,对所有位的和来判断3. 代码就不粘了.

BestCoder Round #50 (div.1) 1002 Run (HDU OJ 5365) 暴力枚举+正多边形判定

题目:Click here 题意:给你n个点,有多少个正多边形(3,4,5,6). 分析:整点是不能构成正五边形和正三边形和正六边形的,所以只需暴力枚举四个点判断是否是正四边形即可. 1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 #include <algorithm> 5 #include <cmath> 6 #define power(x) ((x)*(x))

BestCoder Round #11 (Div. 2) 题解

HDOJ5054 Alice and Bob Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 302    Accepted Submission(s): 229 Problem Description Bob and Alice got separated in the Square, they agreed that if they

BestCoder Round #11 (Div. 2)题解集合

Alice and Bob Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 155    Accepted Submission(s): 110 Problem Description Bob and Alice got separated in the Square, they agreed that if they get sepa