CF488B.Candy Boxes

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

There is an old tradition of keeping 44 boxes of candies in the house in Cyberland. The numbers of candies are special if their arithmetic mean, their median and their range are all equal. By definition, for a set x1,x2,x3,x4{x_{1},x_{2},x_{3},x_{4}} ( x1<=x2<=x3<=x4x_{1}<=x_{2}<=x_{3}<=x_{4} ) arithmetic mean is , median is and range is x4x1x_{4}-x_{1} . The arithmetic mean and median are not necessary integer. It is well-known that if those three numbers are same, boxes will create a "debugging field" and codes in the field will have no bugs.

For example, 1,1,3,31,1,3,3 is the example of 44 numbers meeting the condition because their mean, median and range are all equal to 22 .

Jeff has 44 special boxes of candies. However, something bad has happened! Some of the boxes could have been lost and now there are only nn ( 0<=n<=40<=n<=4 ) boxes remaining. The ii -th remaining box contains aia_{i} candies.

Now Jeff wants to know: is there a possible way to find the number of candies of the 4n4-n missing boxes, meeting the condition above (the mean, median and range are equal)?

输入格式

There is an old tradition of keeping 44 boxes of candies in the house in Cyberland. The numbers of candies are special if their arithmetic mean, their median and their range are all equal. By definition, for a set x1,x2,x3,x4{x_{1},x_{2},x_{3},x_{4}} ( x1<=x2<=x3<=x4x_{1}<=x_{2}<=x_{3}<=x_{4} ) arithmetic mean is , median is and range is x4x1x_{4}-x_{1} . The arithmetic mean and median are not necessary integer. It is well-known that if those three numbers are same, boxes will create a "debugging field" and codes in the field will have no bugs.

For example, 1,1,3,31,1,3,3 is the example of 44 numbers meeting the condition because their mean, median and range are all equal to 22 .

Jeff has 44 special boxes of candies. However, something bad has happened! Some of the boxes could have been lost and now there are only nn ( 0<=n<=40<=n<=4 ) boxes remaining. The ii -th remaining box contains aia_{i} candies.

Now Jeff wants to know: is there a possible way to find the number of candies of the 4n4-n missing boxes, meeting the condition above (the mean, median and range are equal)?

输出格式

There is an old tradition of keeping 44 boxes of candies in the house in Cyberland. The numbers of candies are special if their arithmetic mean, their median and their range are all equal. By definition, for a set x1,x2,x3,x4{x_{1},x_{2},x_{3},x_{4}} ( x1<=x2<=x3<=x4x_{1}<=x_{2}<=x_{3}<=x_{4} ) arithmetic mean is , median is and range is x4x1x_{4}-x_{1} . The arithmetic mean and median are not necessary integer. It is well-known that if those three numbers are same, boxes will create a "debugging field" and codes in the field will have no bugs.

For example, 1,1,3,31,1,3,3 is the example of 44 numbers meeting the condition because their mean, median and range are all equal to 22 .

Jeff has 44 special boxes of candies. However, something bad has happened! Some of the boxes could have been lost and now there are only nn ( 0<=n<=40<=n<=4 ) boxes remaining. The ii -th remaining box contains aia_{i} candies.

Now Jeff wants to know: is there a possible way to find the number of candies of the 4n4-n missing boxes, meeting the condition above (the mean, median and range are equal)?

输入输出样例

  • 输入#1

    2
    1
    1
    

    输出#1

    YES
    3
    3
    
  • 输入#2

    3
    1
    1
    1
    

    输出#2

    NO
    
  • 输入#3

    4
    1
    2
    2
    3
    

    输出#3

    YES
    

说明/提示

For the first sample, the numbers of candies in 44 boxes can be 1,1,3,31,1,3,3 . The arithmetic mean, the median and the range of them are all 22 .

For the second sample, it's impossible to find the missing number of candies.

In the third example no box has been lost and numbers satisfy the condition.

You may output bb in any order.

首页