#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
int n;
vector <int> container;
while(scanf("%d", &n) == 1){
container.push_back(n);
sort(container.begin(), container.end());
int sz = container.size();
if(sz%2 == 0)cout << (container[sz/2]+container[(sz/2)-1])/2 << endl;
else cout << container[sz/2] << endl;
}
return 0;
}
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
int n;
vector <int> container;
while(scanf("%d", &n) == 1){
container.push_back(n);
sort(container.begin(), container.end());
int sz = container.size();
if(sz%2 == 0)cout << (container[sz/2]+container[(sz/2)-1])/2 << endl;
else cout << container[sz/2] << endl;
}
return 0;
}
No comments:
Post a Comment