求助,输出对的,但全wa

P5726 【深基4.习9】打分

jiuli @ 2021-11-29 19:08:30

#include <bits/stdc++.h>
using namespace std;
int n,pi,x,maxn=-1,minn=100;
int main() {
    float tot;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>x;
        if(x>maxn) maxn=x;
        if(x<minn) minn=x;
        pi+=x;
    }
    tot=pi-maxn-minn;
    printf("%.2 f",tot/(n-2));
    return 0;
}

by LeTu_Jun @ 2021-11-29 19:11:43

@hw20孙昊凡

printf("%.2 f",tot/(n-2));

这里的%.2 f有点奇怪

为什么要空格呢?


by jiuli @ 2021-11-29 19:14:46

???

删了竟然对了


by hw20王思捷 @ 2021-11-29 19:15:43

不合法


|