zoukankan      html  css  js  c++  java
  • ZOJ 2970 Faster, Higher, Stronger

    F - Faster, Higher, Stronger
    Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%lld & %llu

    Description

    In the year 2008, the 29th Olympic Games will be held in Beijing. This will signify the prosperity of China and Beijing Olympics is to be a festival for people all over the world as well.

    The motto of Olympic Games is "Citius, Altius, Fortius", which means "Faster, Higher, Stronger".

    In this problem, there are some records in the Olympic Games. Your task is to find out which one is faster, which one is higher and which one is stronger.

    Input

    Standard input will contain multiple test cases. The first line of the input is a single integer T (1 <= T <= 50) which is the number of test cases. And it will be followed by T consecutive test cases.

    Each test case has 3 lines. The first line is the type of the records, which can only be "Faster" "Higher" or "Stronger". The second line is a positive integer N meaning the number of the records in this test case. The third line has N positive integers, i.e. the records data. All the integers in this problem are smaller than 2008.

    Output

    Results should be directed to standard output. The output of each test case should be a single integer in one line. If the type is "Faster", the records are time records and you should output the fastest one. If the type is "Higher", the records are length records. You should output the highest one. And if the type is "Stronger", the records are weight records. You should output the strongest one.

    Sample Input

    3
    Faster
    3
    10 11 12
    Higher
    4
    3 5 4 2
    Stronger
    2
    200 200
    

    Sample Output

    10
    5
    200
    题目意思:输入Faster的时候 输出最小的值,输入Higher和Stronger的时候输出最大的值
    sort一下之后输出判断一下就ok了
     1 #include<iostream>  
     2 #include<string.h>  
     3 #include<stdio.h>  
     4 #include<ctype.h>  
     5 #include<algorithm>  
     6 #include<stack>  
     7 #include<queue>  
     8 #include<set>  
     9 #include<math.h>  
    10 #include<vector>  
    11 #include<map>  
    12 #include<deque>  
    13 #include<list>  
    14 using namespace std;  
    15 int main()
    16 {
    17     int a;
    18     scanf("%d",&a);
    19     while(a--)
    20     {
    21         char b[100];
    22         scanf("%s",b);
    23         int n,m[10000];
    24         scanf("%d",&n);
    25         for(int i=0;i<n;i++)
    26         {
    27             scanf("%d",&m[i]);
    28         }
    29         sort(m,m+n);
    30         if(!strcmp(b,"Faster"))
    31         printf("%d
    ",m[0]);
    32         if(!strcmp(b,"Higher")||!strcmp(b,"Stronger"))
    33         printf("%d
    ",m[n-1]);
    34     }
    35     return 0;
    36 }
    View Code
  • 相关阅读:
    【L.M.W.Y.D】Scrum Meeting 2
    【L.M.W.Y.D】Scrum Meeting 1
    L.M.W.Y.D 实验八 团队作业4—团队项目需求建模与系统设计
    L.M.W.Y.D 实验七 团队作业3:团队项目需求分析与原型设计
    L.M.W.Y.D 实验六 团队作业2:健康管理系统
    L.M.W.Y.D 实验五 团队作业1:软件研发团队组建与软件案例分析
    多喝热水 [Alpha] Scrum Meeting 3
    多喝热水 [Alpha] Scrum Meeting 2
    多喝热水 [Alpha] Scrum Meeting 1
    多喝热水 实验八 团队作业4:团队项目需求建模与系统设计
  • 原文地址:https://www.cnblogs.com/qscqesze/p/3851776.html
Copyright © 2011-2022 走看看