问题标题: 酷町堂:5603

0
0
已解决
吕梓瑜
吕梓瑜
初级天翼
初级天翼
#pra**a GCC optimize(3)
#pra**a GCC target("avx")
#pra**a GCC optimize("Ofast")
#pra**a GCC optimize("inline")
#pra**a GCC optimize("-fg**e")
#pra**a GCC optimize("-fg**e-lm")
#pra**a GCC optimize("-fipa-sra")
#pra**a GCC optimize("-ftree-pre")
#pra**a GCC optimize("-ftree-vrp")
#pra**a GCC optimize("-fpeephole2")
#pra**a GCC optimize("-ffast-math")
#pra**a GCC optimize("-fsched-spec")
#pra**a GCC optimize("un**ll-loops")
#pra**a GCC optimize("-fali**-jumps")
#pra**a GCC optimize("-fali**-loops")
#pra**a GCC optimize("-fali**-labels")
#pra**a GCC optimize("-fdevirtualize")
#pra**a GCC optimize("-fcaller-saves")
#pra**a GCC optimize("-fc**ssjumping")
#pra**a GCC optimize("-fthread-jumps")
#pra**a GCC optimize("-fun**ll-loops")
#pra**a GCC optimize("-fwhole-p**gram")
#pra**a GCC optimize("-freorder-blocks")
#pra**a GCC optimize("-fschedule-insns")
#pra**a GCC optimize("inline-functions")
#pra**a GCC optimize("-ftree-tail-merge")
#pra**a GCC optimize("-fschedule-insns2")
#pra**a GCC optimize("-fst**ct-aliasing")
#pra**a GCC optimize("-fst**ct-overflow")
#pra**a GCC optimize("-fali**-functions")
#pra**a GCC optimize("-f**e-skip-blocks")
#pra**a GCC optimize("-f**e-follow-jumps")
#pra**a GCC optimize("-fsched-interblock")
#pra**a GCC optimize("-fpartial-inlining")
#pra**a GCC optimize("no-stack-p**tector")
#pra**a GCC optimize("-freorder-functions")
#pra**a GCC optimize("-findirect-inlining")
#pra**a GCC optimize("-fhoist-adjacent-loads")
#pra**a GCC optimize("-frerun-**e-after-loop")
#pra**a GCC optimize("inline-**all-functions")
#pra**a GCC optimize("-finline-**all-functions")
#pra**a GCC optimize("-ftree-switch-conversion")
#pra**a GCC optimize("-foptimize-sibling-calls")
#pra**a GCC optimize("-fexpensive-optimizations")
#pra**a GCC optimize("-funsafe-loop-optimizations")
#pra**a GCC optimize("inline-functions-called-once")
#pra**a GCC optimize("-fdelete-null-pointer-checks")
#pra**a GCC optimize(2)
#include<bits/stdc++.h>
#include<algo**thm>
#include<iostream>
#include<iomanip>
#include<**t**ng>
#include<st**ng>
#include<**tdio>
#include<cmath>
using name** std;
int b[505],maxn=0,minn=505,maxx,cnt1,cnt2,cnt3,sum;
int main()
{
    //freopen(".in","r",stdin);
    //freopen(".out","w",stdout);
    int n,a[10005],p,q;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        b[a[i]]++;
        if(a[i]>maxn){
            maxn=a[i];
        }
        if(a[i]<minn){
            minn=a[i];
        }
    }
    cin>>p>>q;
    for(int i=1;i<=n;i++){
        if(a[i]==minn){
            cnt1++;
        }
        if(a[i]==maxn){
            cnt2++;
        }
    }
    cout<<minn<<" "<<cnt1<<endl<<maxn<<" "<<cnt2<<endl;
    for(int i=1;i<=500;i++){
        if(b[i]>=maxx){
            maxx=b[i];
        }
    }
    for(int i=1;i<=500;i++){
        if(b[i]==maxx){
            cout<<i<<" "<<b[i]<<" ";
        }
    }
    for(int i=p;i<=q;i++){
        sum+=b[i];
    }
    cout<<endl<<sum;
    //fclose(stdin);
    //fclose(stdout);
    ret**n 0;
}

各位大佬,请问5603这样写为什么是90分?

https://ke.codingtang.com/#/p**blem/p**blemSub?id=5603

错误测试点:

输入(显示前50行):
10
0 0 0 0 0 0 0 0 0 0 
85 95
输出(显示前50行):
0 10
0 10
0 10 
0

 


0
已采纳
汪宇航
汪宇航
新手启示者
新手启示者

1、输入

2、在循环输入时桶[数]++

3、sort,输出最大值和桶[最大值],以及最小值和桶[最小值]

4、输出重复数和重复次数

5、输出p~q的数的个数

我要回答