3 solutions

  • 1
    @ 2026-6-14 14:49:40
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
        int a;
        cin>>a;
        int c=0;
        int d=0;
        int e=0;
        int f=0;
        for (int i=1;i<=a;i++)
    	{
        	int b;
        	cin>>b;
    	if (b>=0 and b<=18)
    	{
    		c++;
    	}
    	else if (b>=19 and b<=35)
    	{
    		d++;
    	}
    	else if (b>=36 and b<=60)
    	{
    		e++;
    	}
    	else if (b>=61)
    	{
    		f++;
    	}
    }
    	cout<<fixed<<setprecision(2)<<c*100.0/a<<"%"<<endl;
    	cout<<fixed<<setprecision(2)<<d*100.0/a<<"%"<<endl;
    	cout<<fixed<<setprecision(2)<<e*100.0/a<<"%"<<endl;
    	cout<<fixed<<setprecision(2)<<f*100.0/a<<"%"<<endl;
        return 0;
    }
    

    Information

    ID
    3478
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    1
    Tags
    # Submissions
    40
    Accepted
    26
    Uploaded By