ZOJ 3869 Ace of Aces (The 12th Zhejiang Provincial Collegiate Programming Contest)
2015-04-25 21:32
453 查看
【题目链接】click here~~
【题目大意】每张票有不同的投票数,如果有两张或以上的相同则无法选拔“Ace of Aces”,给出票的数目,判断是否符合
【解题思路】:签到题
代码:
【题目大意】每张票有不同的投票数,如果有两张或以上的相同则无法选拔“Ace of Aces”,给出票的数目,判断是否符合
【解题思路】:签到题
代码:
#include<bits/stdc++.h> using namespace std; int a[1001]; int main() { // freopen("in.txt","r",stdin); int T; cin>>T;; while(T--) { memset(a,0,sizeof(a)); int top; int n; cin>>n;; for(int i=0; i<n; i++){ cin>>top; a[top]++;//每张票的得数 } bool flag=0; int maxx=0; int res=-1; for(int i=0; i<1001; i++) if(maxx<a[i])//得出最大投票的人 { maxx=a[i]; res=i; } for(int i=0; i<1001; i++) if(maxx==a[i]&&res!=i) { puts("Nobody"); flag=1; break; } if(flag) continue; else printf("%d\n",res); } return 0; }
相关文章推荐
- zjuoj The 12th Zhejiang Provincial Collegiate Programming Contest Ace of Aces
- Ace of Aces【The 12th Zhejiang Provincial Collegiate Programming Contest】
- ZOJ 3872 Beauty of Array (The 12th Zhejiang Provincial Collegiate Programming Contest )
- ZOJ 3872 Beauty of Array (The 12th Zhejiang Provincial Collegiate Programming Contest )
- ZOJ 3878 Convert QWERTY to Dvorak (The 12th Zhejiang Provincial Collegiate Programming Contest)
- ZOJ 3870 Team Formation (The 12th Zhejiang Provincial Collegiate Programming Contest 数位DP+二分)
- ZOJ 3875 Lunch Time (The 12th Zhejiang Provincial Collegiate Programming Contest )
- zoj The 12th Zhejiang Provincial Collegiate Programming Contest Demacia of the Ancients
- ZOJ 3876 May Day Holiday (The 12th Zhejiang Provincial Collegiate Programming Contest)
- ZOJ 3878 The 12th Zhejiang Provincial Collegiate Programming Contest - J
- The 12th Zhejiang Provincial Collegiate Programming Contest - H
- zoj The 12th Zhejiang Provincial Collegiate Programming Contest Capture the Flag
- The 12th Zhejiang Provincial Collegiate Programming Contest
- The 12th Zhejiang Provincial Collegiate Programming Contest - J
- Lunch Time【The 12th Zhejiang Provincial Collegiate Programming Contest】
- 140 - The 12th Zhejiang Provincial Collegiate Programming Contest(第二部分)
- ZOJ-The 14th Zhejiang Provincial Collegiate Programming Contest Sponsored by TuSimple-E
- The 12th Zhejiang Provincial Collegiate Programming Contest - L
- 140 - The 12th Zhejiang Provincial Collegiate Programming Contest(第二部分)
- The 12th Zhejiang Provincial Collegiate Programming Contest - I Earthstone Keeper浙江省赛