Description

输入若干个int类型的整数,求它们的最大值及其个数。

Input

输入 若干个int类型的整数,至文件尾为止。

Output

输出只有一行:There are # maximum number &.

其中#是最大值的个数,&是最大值。

Sample Input

1 2 3 4 5 6 6 5 4 3 2 1 6 6 6

Sample Output

There are 5 maximum number 6.
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
using namespace std;
int main()
{
    int inum=0;
    int imax=-9999999;
    int t;
    while(cin>>t)
    {
        int tem=imax;
        imax=max(imax,t);
        if(tem==imax&&tem==t)
            inum++;
        else if(tem<imax)
            inum=1;
    }
    cout<<"There are "<<inum<<" maximum number "<<imax<<"."<<endl;
}

  

Problem F: 多少个最大值?的更多相关文章

  1. 几何入门合集 gym101968 problem F. Mirror + gym102082 Problem F Fair Chocolate-Cutting + gym101915 problem B. Ali and Wi-Fi

    abstract: V const & a 加速 F. Mirror 题意 链接 问题: 有n个人在y=0的平面上(及xoz平面).z=0平面上有一面镜子(边平行于坐标轴).z=a平面上有q个 ...

  2. 2013-2014 ACM-ICPC, NEERC, Southern Subregional Contest Problem F. Judging Time Prediction 优先队列

    Problem F. Judging Time Prediction 题目连接: http://www.codeforces.com/gym/100253 Description It is not ...

  3. 2013级新生程序设计基础竞赛-正式赛 F 异或最大值 解题报告

    F - 异或最大值 Time Limit: 2000/1000MS (Java/Others)      Memory Limit: 128000/64000KB (Java/Others) Subm ...

  4. 实验12:Problem F: 求平均年龄

    Home Web Board ProblemSet Standing Status Statistics   Problem F: 求平均年龄 Problem F: 求平均年龄 Time Limit: ...

  5. The Ninth Hunan Collegiate Programming Contest (2013) Problem F

    Problem F Funny Car Racing There is a funny car racing in a city with n junctions and m directed roa ...

  6. Codeforces Gym 100500F Problem F. Door Lock 二分

    Problem F. Door LockTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100500/at ...

  7. Codeforces Gym 100002 Problem F "Folding" 区间DP

    Problem F "Folding" Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/ ...

  8. Codeforces Gym 100286F Problem F. Fibonacci System 数位DP

    Problem F. Fibonacci SystemTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudg ...

  9. Problem F: Exponentiation

    Problem F: ExponentiationTime Limit: 1 Sec Memory Limit: 128 MBSubmit: 4 Solved: 2[Submit][Status][W ...

随机推荐

  1. Laravel5 控制器

    Request 一.取值 1.取值 echo $request->input('name','这是默认值'); 2.取得所有值 $array=$request->all(); 3.判断值是 ...

  2. OpenVPN CentOS7 安装部署配置详解

    一 .概念相关 1.vpn 介绍 vpn 虚拟专用网络,是依靠isp和其他的nsp,在公共网络中建立专用的数据通信网络的技术.在vpn中任意两点之间的链接并没有传统的专网所需的端到端的物理链路,而是利 ...

  3. docker镜像文件导入与导出

    工作中经常需要拉取一些国外的镜像,但是网络限制等原因在公司拉取很慢,所以我习惯用亚马逊服务器拉取镜像,导出后下载到本地再导入开发环境 1. 查看镜像id sudo docker images REPO ...

  4. SQLServer中重建聚集索引之后会影响到非聚集索引的索引碎片吗

    本文出处:http://www.cnblogs.com/wy123/p/7650215.html (保留出处并非什么原创作品权利,本人拙作还远远达不到,仅仅是为了链接到原文,因为后续对可能存在的一些错 ...

  5. 由 System.arraycopy 引发的巩固:对象引用 与 对象 的区别

    作者:林冠宏 / 指尖下的幽灵 掘金:https://juejin.im/user/587f0dfe128fe100570ce2d8 博客:http://www.cnblogs.com/linguan ...

  6. clone github报Permission denied (publickey) 解决方案

    问题描述 问题产生的原因,不是很清楚,就不管了.在执行git clone git@github.com:****.git 的时候报了Permission denied (publickey). War ...

  7. HDU1166 数状数组

    敌兵布阵 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submi ...

  8. Promise 对象

    Promise 对象用于处理异步请求,保存一个异步操作最终完成(或失败)的结果 语法 new Promise( /* executor */ function(resolve, reject) {.. ...

  9. 解决Android5.0以下Dialog引起的内存泄漏

    最近项目开发中,开发人员和测试人员均反应在android5.0以下手机上LeakCanary频繁监控到内存泄漏,如下图所示,但凡用到Dialog或DialogFragment地方均出现了内存泄漏. 如 ...

  10. linux命令和awk

    1.统计一下代码量 find . -name "*.py" | xargs wc -l | awk 'BEGIN {size = 0} { size+=$1} END{print ...