柚子快报激活码778899分享:8月11号团队赛水题走一波

http://yzkb.51969.com/

1. Fair Game

Description

Petya and Vasya decided to play a game. They have n cards (n is an even number). A single integer is written on each card.

Before the game Petya will choose an integer and after that Vasya will choose another integer (different from the number that Petya chose). During the game each player takes all the cards with number he chose. For example, if Petya chose number 5 before the game he will take all cards on which 5 is written(拿走全是5的牌) and if Vasya chose number 10 before the game he will take all cards on which 10 is written.

The game is considered fair if Petya and Vasya can take all n cards, and the number of cards each player gets is the same.

Determine whether Petya and Vasya can choose integer numbers before the game so that the game is fair.

Input

The first line contains a single integer n (2 ≤ n ≤ 100) — number of cards. It is guaranteed that n is an even number.

The following n lines contain a sequence of integers a1, a2, ..., an (one integer per line, 1 ≤ ai ≤ 100) — numbers written on then cards.

Output

If it is impossible for Petya and Vasya to choose numbers in such a way that the game will be fair, print "NO" (without quotes) in the first line. In this case you should not print anything more.

In the other case print "YES" (without quotes) in the first line. In the second line print two distinct integers — number that Petya should choose and the number that Vasya should choose to make the game fair. If there are several solutions, print any of them.

Sample Input

Input

411272711

Output

YES11 27

Input

266

Output

NO

Input

6102030201020

Output

NO

Input

6112233

Output

NO

Hint

In the first example the game will be fair if, for example, Petya chooses number 11, and Vasya chooses number 27. Then the will take all cards — Petya will take cards 1 and 4, and Vasya will take cards 2 and 3. Thus, each of them will take exactly two cards.

In the second example fair game is impossible because the numbers written on the cards are equal, but the numbers that Petya and Vasya should choose should be distinct.

In the third example it is impossible to take all cards. Petya and Vasya can take at most five cards — for example, Petya can choose number 10 and Vasya can choose number 20. But for the game to be fair it is necessary to take 6 cards.

 

题目意思:给你n张牌,问是不是两种牌,并且数量相等。是的话还要输出两种牌。

1 #include

2 #include

3 #include

4 #include

5 using namespace std;

6 mapmp;

7 map::iterator it;

8 int main()

9 {

10 int n,a,i;

11 scanf("%d",&n);

12 for(i=0;i

13 {

14 scanf("%d",&a);

15 mp[a]++;

16 }

17 if(mp.size()==2&&mp[a]==n/2)

18 {

19 printf("YES\n");

20 for(it=mp.begin();it!=mp.end();it++)

21 {

22 printf("%d ",it->first);

23 }

24 }

25 else

26 {

27 printf("NO\n");

28 }

29 return 0;

30 }

 

2.Hungry Student Problem

Description

Ivan's classes at the university have just finished, and now he wants to go to the local CFK cafe and eat some fried chicken.

CFK sells chicken chunks in small and large portions. A small portion contains 3 chunks; a large one — 7 chunks. Ivan wants to eat exactly x chunks. Now he wonders whether he can buy exactly this amount of chicken.

Formally, Ivan wants to know if he can choose two non-negative integers a and b in such a way that a small portions and b large ones contain exactly x chunks.

Help Ivan to answer this question for several values of x!

Input

The first line contains one integer n (1 ≤ n ≤ 100) — the number of testcases.

The i-th of the following n lines contains one integer xi (1 ≤ xi ≤ 100) — the number of chicken chunks Ivan wants to eat.

Output

Print n lines, in i-th line output YES if Ivan can buy exactly xi chunks. Otherwise, print NO.

Sample Input

Input

265

Output

YESNO

Hint

In the first example Ivan can buy two small portions.

In the second example Ivan cannot buy exactly 5 chunks, since one small portion is not enough, but two small portions or one large is too much.

题目意思:判断一个数是否只能由3或者7组成。

解题思路:可以暴力一下也就100的数据量。

 

1 #include

2 using namespace std;

3 int main()

4 {

5 int n,x;

6 bool flag;

7 cin>>n;

8 while(n--)

9 {

10 flag=0;

11 cin>>x;

12 for(int i=0; i<=100; i++)

13 for(int j=0; j<=100; j++)

14 {

15 if(x==i*3+j*7)

16 {

17 flag=1;

18 break;

19 }

20 }

21 if(flag)

22 puts("YES");

23 else

24 puts("NO");

25 }

26 return 0;

27 }

 

不过这道题是有着一些规律的,只用3和7能够构成任何一个大于等于12的数!!!

1 #include

2 #include

3 #include

4 #include

5 #include

6 using namespace std;

7

8 int main()

9 {

10 int t;

11 int n;

12 scanf("%d", &t);

13 while (t--)

14 {

15 scanf("%d", &n);

16 if (n % 3 == 0 || n % 7 == 0 || n == 10 || n > 12)

17 {

18 printf("YES\n");

19 }

20 else

21 {

22 printf("NO\n");

23 }

24 }

25 return 0;

26 }

 

 

 

3. Find Extra One

 

Description

You have n distinct points on a plane(平面), none of them lie on OY axis. Check that there is a point after removal of which the remaining points(剩余的点) are located on one side of the OY axis.

Input

The first line contains a single positive integer n (2 ≤ n ≤ 105).

The following n lines contain coordinates of the points. The i-th of these lines contains two single integers xi and yi (|xi|, |yi| ≤ 109, xi ≠ 0). No two points coincide.

Output

Print "Yes" if there is such a point, "No" — otherwise.

You can print every letter in any case (upper or lower).

Sample Input

Input

3 1 1 -1 -1 2 -1

Output

Yes

Input

4 1 1 2 2 -1 1 -2 2

Output

No

Input

3 1 2 2 1 4 60

Output

Yes

Hint

In the first example the second point can be removed.

In the second example there is no suitable for the condition point.

In the third example any point can be removed.

 

题目意思:能否存在这样一个点,删除该点之后,剩余的所有点都在y轴的同一侧。

解题思路:主要是判断在数据中在y轴两侧的个数,如果x>0和x<0的个数都大于1,那么肯定是不可能存在的。

 

1 #include

2 #include

3 int main()

4 {

5 int n,a,b,counts1,counts2,i;

6 counts1=0;

7 counts2=0;

8 scanf("%d",&n);

9 for(i=0;i

10 {

11 scanf("%d%d",&a,&b);

12 if(a<0)

13 {

14 counts1++;

15 }

16 else

17 {

18 counts2++;

19 }

20 }

21 if(counts1>1&&counts2>1)

22 {

23 printf("No\n");

24 }

25 else

26 {

27 printf("Yes\n");

28 }

29 return 0;

30 }

 

 

 

 

 

 

柚子快报激活码778899分享:8月11号团队赛水题走一波

http://yzkb.51969.com/

精彩内容

评论可见,请评论后查看内容,谢谢!!!评论后请刷新页面。