GYM 101149 A.Balls in Urn(水~)
来源:互联网 发布:sql 比较运算符 编辑:程序博客网 时间:2024/05/21 09:46
Description
一次箱子里有n种颜色的球,第i种颜色球有a[i]个,现在可以选出一个球得知其数量,之后会从箱子里一个个把所有球都拿出来要猜其颜色,让最坏情况下猜对的次数最大
Input
第一行一整数n表示球的颜色数量,之后n个整数a[i]表示第i种颜色的小球数量(1<=n<=2e5,1<=a[i]<=1e9)
Output
输出最坏情况下猜对的最多次数
Sample Input
4
5 2 2 9
Sample Output
9
Solution
求出a[i]的最大值即可
Code
#include<cstdio>#include<iostream>#include<cstring>#include<algorithm>#include<cmath>#include<vector>#include<queue>#include<map>#include<set>#include<ctime>using namespace std;typedef long long ll;#define INF 0x3f3f3f3f#define maxn 1111int n,a,Max; int main(){ while(~scanf("%d",&n)) { Max=0; while(n--) { scanf("%d",&a); Max=max(Max,a); } printf("%d\n",Max); } return 0;}
0 0
- GYM 101149 A.Balls in Urn(水~)
- Gym 101149A Balls in Urn
- Gym 101341C Urn with Balls 签到
- GYM 100827 A.Runes(水~)
- Codeforces Gym 101174 K. Balls and Needles (DFS)
- Codeforces 653A: Bear and Three Balls(技巧,水)
- Gym 100803A(贪心)
- GYM 101086 H.Another Square in the Floor(水~)
- GYM 100694 I.Goat in the Field(水~)
- GYM 100488 A. Yet Another Goat in the Garden(计算几何)
- codeforces Gym 100269K——Kids in a Friendly Class(可图性判定)
- GYM 100090 A. After Two Hares(水~)
- GYM 100488 E.Just Change a Word(水~)
- GYM 100712 A.Who Is The Winner?(水~)
- GYM 101086 A.My Friend of Misery(水~)
- CodeForces Gym 100989F Mission in Amman (A)
- Gym 100685A Ariel (&运算)
- Gym 100851A - Adjustment Office(模拟)
- OkHttp源码阅读之旅(一)
- leetcode83~Remove Duplicates from Sorted List
- tomcat什么鬼,apache tomcat 一种服务器了咦
- 强化学习读书笔记_0
- Java初始化
- GYM 101149 A.Balls in Urn(水~)
- Node JS 中遇到过的问题
- 割点(模板)
- Spark性能优化指南——基础篇
- 割点(模板)
- 我的第一篇博客
- JDBC连接MySQL数据库
- DNA排序算法(三)
- 集合相似度 pat