시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
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
W3sicHJvYmxlbV9pZCI6IjM3NjkiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWNkNWNcdWIzMDBcdWFjMTIiLCJkZXNjcmlwdGlvbiI6IjxwPng8c3ViPjE8XC9zdWI+LCB4PHN1Yj4yPFwvc3ViPiwgLi4uLCB4PHN1Yj5tPFwvc3ViPlx1Yjk3YyBcdWM1YjRcdWI1YTQgXHVjODE1XHVjMjE4IGFcdWM2NDAgYlx1YzVkMCBcdWIzMDBcdWQ1NzRcdWMxMWMgXHViMmU0XHVjNzRjIFx1Yzg3MFx1YWM3NFx1Yzc0NCBcdWI5Y2NcdWM4NzFcdWQ1NThcdWIyOTQgXHVjMmU0XHVjMjE4XHViNzdjXHVhY2UwIFx1ZDU1OFx1Yzc5MC4gKGEmZ3Q7MCk8XC9wPlxyXG5cclxuXHJcblxyXG48cD5hKSZuYnNwOzxpbWcgYWx0PVwiXCIgc3JjPVwiXC91cGxvYWRcL2ltYWdlc1wvZGF1bV9lcXVhdGlvbl8xMzU3NzU4NDk2NTI4LnBuZ1wiIHN0eWxlPVwiaGVpZ2h0OjYycHg7IHdpZHR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08XC9zdWI+IHNhdGlzZnlpbmcgdGhlIGdpdmVuIGNvbmRpdGlvbnMuJm5ic3A7PFwvcD5cclxuIiwib3V0cHV0IjoiPHA+Rm9yIGVhY2ggaW5wdXQgbGluZSBwcmludCBvbmUgbnVtYmVyICZuZGFzaDsgdGhlIG1heGltdW0gdmFsdWUgb2YgZXhwcmVzc2lvbiwgZ2l2ZW4gYWJvdmUuIFRoZSBhbnN3ZXIgbXVzdCBiZSByb3VuZGVkIHRvIHRoZSBuZWFyZXN0IGludGVnZXIuJm5ic3A7PFwvcD5cclxuIiwiaGludCI6IiIsIm9yaWdpbmFsIjoiMSIsInByb2JsZW1fbGFuZ19jb2RlIjoiXHVjNjAxXHVjNWI0In1d

출처

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

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