1 #define mm(a) memset(a,0,sizeof(a)); 2 #define max(x,y) (x)>(y)?(x):(y) 3 #define min(x,y) (x)<(y)?(x):(y) 4 #define Fopen freopen("1.in","r",stdin); freopen("m.out","w",stdout); 5 #define rep(i,a,b) for(int i=(a);i<=(b);i++) 6 #define per(i,b,a) for(int i=(b);i>=(a);i--) 7 #include<bits/stdc++.h> 8 typedef long long ll; 9 #define PII pair<ll,ll> 10 using namespace std; 11 const int INF=0x3f3f3f3f; 12 const int MAXN=(int)1e5 + 5; 13 14 vector<int>v; 15 int main() { 16 string input,temp; 17 while (cin >> input) { 18 istringstream iss(input); 19 v.clear(); 20 int max1=0; 21 int min1=INF; 22 while (getline(iss, temp, ‘,‘)) { 23 int x=atoi(temp.c_str()); 24 v.push_back(x); 25 } 26 int n=v.size(); 27 sort(v.begin(),v.end()); 28 printf("%d\n",v[n/2]); 29 } 30 return 0; 31 }
20 int max1=0;
21 int min1=INF;
20 int max1 = 0;
21 int min1 = INF;
原文地址:https://www.cnblogs.com/dogenya/p/10815582.html
时间: 2024-11-01 21:21:26