시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
5 초 128 MB 26 4 3 100.000%

문제

x1, x2, ..., xm를 어떤 정수 a와 b에 대해서 다음 조건을 만족하는 실수라고 하자. (a>0)

a) 

b)  

이때, 짝수인 양의 정수 p가 주어졌을 때, x1p+x2p+...+xmp의 최댓값을 구하는 프로그램을 작성하시오.

입력

첫째 줄에 테스트 케이스의 개수 T가 주어진다. 각 테스트 케이스는 한 줄이고, m, p, a, b로 이루어져 있다. (m ≤ 2000, p ≤ 12, p는 짝수)

항상 주어진 조건을 만족하는 x1, x2, ..., xm이 존재하는 경우만 입력으로 주어진다.

출력

각 테스트 케이스에 대해, 한 줄에 하나씩 문제에 주어진 식의 최댓값을 소수점 첫째자리에서 반올림해서 출력한다.

예제 입력 1

2
1997 12 3 -318
10 2 4 -1

예제 출력 1

189548
6
W3sicHJvYmxlbV9pZCI6IjM3NjkiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWNkNWNcdWIzMTNcdWFjMTIiLCJkZXNjcmlwdGlvbiI6IjxwPng8c3ViPjE8XC9zdWI+LCB4PHN1Yj4yPFwvc3ViPiwgLi4uLCB4PHN1Yj5tPFwvc3ViPlx1Yjk3YyBcdWM1YjRcdWI1YTQgXHVjODE1XHVjMjE4IGFcdWM2NDAgYlx1YzVkMCBcdWIzMDBcdWQ1NzRcdWMxMWMgXHViMmU0XHVjNzRjIFx1Yzg3MFx1YWM3NFx1Yzc0NCBcdWI5Y2NcdWM4NzFcdWQ1NThcdWIyOTQgXHVjMmU0XHVjMjE4XHViNzdjXHVhY2UwIFx1ZDU1OFx1Yzc5MC4gKGEmZ3Q7MCk8XC9wPlxyXG5cclxuXHJcblxyXG48cD5hKSZuYnNwOzxpbWcgYWx0PVwiXCIgc3JjPVwiXC91cGxvYWRcL2ltYWdlc1wvZGF1bV9lcXVhdGlvbl8xMzU3NzU4NDk2NTI4LnBuZ1wiIHN0eWxlPVwiaGVpZ2h0OjYycHg7IHdpZH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xzdWI+bTxcL3N1Yj4gc2F0aXNmeWluZyB0aGUgZ2l2ZW4gY29uZGl0aW9ucy4mbmJzcDs8XC9wPlxyXG4iLCJvdXRwdXQiOiI8cD5Gb3IgZWFjaCBpbnB1dCBsaW5lIHByaW50IG9uZSBudW1iZXIgJm5kYXNoOyB0aGUgbWF4aW11bSB2YWx1ZSBvZiBleHByZXNzaW9uLCBnaXZlbiBhYm92ZS4gVGhlIGFuc3dlciBtdXN0IGJlIHJvdW5kZWQgdG8gdGhlIG5lYXJlc3QgaW50ZWdlci4mbmJzcDs8XC9wPlxyXG4iLCJoaW50IjoiIiwib3JpZ2luYWwiOiIxIiwicHJvYmxlbV9sYW5nX2NvZGUiOiJcdWM2MDFcdWM1YjQifV0=

출처

ACM-ICPC > Regionals > Europe > Southeastern European Regional Contest > SEERC 2006 G번

  • 문제를 번역한 사람: baekjoon
  • 문제의 오타를 찾은 사람: h0ngjun7