1 solutions

  • 1
    @ 2024-7-19 9:49:18
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    	vector<int> v;
    	int x;
    	while(cin>>x,x)
    	{
    		v.push_back(x);
    	}
    	sort(v.begin(),v.end());
    	int n=v.size();
    	if(n&1)
    	{
    		cout<<v[n/2];
    	}
    	else
    	{
    		cout<<(v[n/2-1]+v[n/2])/2.0;
    	}
    	return 0;
    }
    
  • 1

Information

ID
149
Time
1000ms
Memory
256MiB
Difficulty
1
Tags
(None)
# Submissions
59
Accepted
28
Uploaded By