• اگر سمپادی هستی همین الان عضو شو :
    ثبت نام عضویت

يك سوال از سوالاي اي سي ام روي حكم شريف

وضعیت
موضوع بسته شده است.
  • شروع کننده موضوع
  • #1

princess

کاربر نیمه‌فعال
ارسال‌ها
11
امتیاز
7
نام مرکز سمپاد
فرزانگان تهران
شهر
تهران
مدال المپیاد
کامپیوتر ریاضی
دانشگاه
امیرکبیر
رشته دانشگاه
علوم کامپیوتر
faverage
محدودیت زمان پردازش: 1000 میلی‌ثانیه
محدودیت حافظه: 32000 کیلوبایت
Funny Average
Think of how stupid the average person is, and realize half of them are stupider than that.
George Carlin
Take n integers.
Compute their average. Call it A1.
Throw away all the ones that are smaller than A1.
Compute the average of what remains. Call it A2.
Throw away all the integers that are larger than A2.
Compute the average of what remains. Call it A3.
Keep doing this forever, throwing away the small ones, then the large ones, then the small ones again, and so on. At some point, the average will stop changing. Your job is to figure out what that final "steady-state" average will be.
Input
The input starts with a line giving the number of test cases, N. Each test case will consist of two lines, the first one giving n (1 ≤ n ≤ 30000), and the second one giving n integers (each one between -30000 and 30000).
Output
For each test case, output one line containing "Case #x:" followed by the final average, rounded to 3 decimal places.
Sample
Standard Input
4
3
1 2 3
1
7
9
1 2 3 4 5 7 6 8 9
4
1 2 2 2
Standard Output
Case #1: 2.000
Case #2: 7.000
Case #3: 6.000
Case #4: 2.000

 

sajadjalali

کاربر فعال
ارسال‌ها
28
امتیاز
2
نام مرکز سمپاد
شهید علی اکبر ا‌ژه ای
شهر
اصفهان
مدال المپیاد
کامپیوتر
رشته دانشگاه
ان شاالله نرم افزار
پاسخ : يك سوال از سوالاي اي سي ام روي حكم شريف

میگم اگه میشه منبعشو بدین (لینک) گشتم پیدا نکردم
 
  • شروع کننده موضوع
  • #3

princess

کاربر نیمه‌فعال
ارسال‌ها
11
امتیاز
7
نام مرکز سمپاد
فرزانگان تهران
شهر
تهران
مدال المپیاد
کامپیوتر ریاضی
دانشگاه
امیرکبیر
رشته دانشگاه
علوم کامپیوتر
پاسخ : يك سوال از سوالاي اي سي ام روي حكم شريف

http://acm.sharif.edu/arbiter/translation/view.jsf?name=faverage

اگر همين جوري هم بخواين برين تو سايت فكر كنم بايد اول برين تو محيط ACM_Training شناسه ي اين سوال 3 است!
 
وضعیت
موضوع بسته شده است.
بالا