ural 1306
题目:http://acm.timus.ru/problem.aspx?space=1&num=1306
很想说这个题目很无语,最后还是在discuss http://acm.timus.ru/forum/thread.aspx?id=19974&upd=634679402957920104 里看的这个人说的,才过的
View Code
1 typedef unsigned int ll; 2 int main() 3 { 4 priority_queue<ll>pr; 5 ll a; 6 int n,i; 7 //freopen("data.txt","r",stdin); 8 cin>>n; 9 for(i = 1; i <= n / 2 + 1; i++) 10 { 11 cin>>a; 12 pr.push(a); 13 } 14 i = n / 2 + 2; 15 while(i <= n) 16 { 17 cin>>a; 18 pr.push(a); 19 i++, pr.pop(); 20 } 21 a = pr.top(); 22 pr.pop(); 23 ll b = pr.top(); 24 if(n % 2) cout<<a<<".0"<<endl; 25 else 26 { 27 if((a % 2 + b % 2) % 2 == 0) 28 { 29 cout<<(a / 2 + b / 2 + a % 2)<<".0"<<endl; 30 } 31 else 32 { 33 cout<<(a / 2 + b / 2)<<".5"<<endl; 34 } 35 } 36 return 0; 37 }