zoukankan      html  css  js  c++  java
  • nbut 1115, 乱搞?

    B - Cirno's Trick
    Time Limit:1000MS     Memory Limit:65535KB     64bit IO Format:%I64d & %I64u

    Description

    Cirno(チ ルノ) is an ice elf. Her hobby is tricking on others. But the biggest problem is that - Cirno is too foolish to do tricking. She knows this, so she makes statistics to calculate the probability that she can do tricking successfully.

    Cirno writes down some probabilities that she may succeed. And she delete the lowest one, because it's too foolish and she can't believe in it. Then she delete the highest one, because she thinks it's impossible.
    After that, she wants to know the average of the left probabilities.

    Input

    This problem has several cases.
    The first line of each case is an integer N (2 < N <= 1000), indicates the number of probabilities.
    Then follows one line which containing N integers, indicate the probabilities. Each probability is a decimal between 0 and 100.

    Output

    For each case, you should output the average of the left probabilities. Keep two decimal places.

    Sample Input

    3
    0.0 50.0 100.0
    

    Sample Output

    50.00
    

    Hint

    Use 'double' to replace 'float'.
    #include<iostream>
    #include<cstdio>
    #include<cstring>
    #include<string>
    #include<cmath>
    #include<vector>
    #include<cstdlib>
    #include<algorithm>
    
    using namespace std;
    
    #define LL long long
    #define ULL unsigned long long
    #define UINT unsigned int
    #define MAX_INT 0x7fffffff
    #define MAX_LL 0x7fffffffffffffff
    #define MAX(X,Y) ((X) > (Y) ? (X) : (Y))
    #define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
    
    int n;
    double p[1111];
    
    int main(){
    //  fstream fin("C:\Users\Administrator\Desktop\in.txt",ios::in);
    
        while(scanf(" %d",&n)==1){
            int i,j;
            double s=0,t1=111,t2=0;
            for(i=0; i<n; i++){
                scanf(" %lf",&p[i]);
                if(t1 > p[i]) t1=p[i];
                if(t2 < p[i]) t2=p[i];
                s+=p[i];
            }
            s =s- t1-t2;
            printf("%.2f
    ",s/(n-2));
        }
    
    //  fin.close();
        return 0;
    }
    

  • 相关阅读:
    Aptana 开发环境执行时默认的工作路径
    python 日志工具 Dict4ini 的简单使用示例
    C语言中的条件编译
    Ammyy Admin 一个小巧方便的远程管理工具
    djangoevolution 插件维持Django 模型和数据库结构一致的基本原理
    关于Django 框架的ContentType 模型
    关于 Django web请求中的Cookie
    GridView中,显示记录的总条数
    SQL 日期格式
    .net如何实现页面间的参数传递
  • 原文地址:https://www.cnblogs.com/ramanujan/p/3413024.html
Copyright © 2011-2022 走看看