Home > Back-end >  C to draw (OJ exercises of the affiliated high school of fujian normal university)
C to draw (OJ exercises of the affiliated high school of fujian normal university)

Time:05-24


Question C: draw
Time limit: 1 Sec memory limit: 128 MB
Commit: 782:140
[submit] [state] [discussion boards]
Title description
Your friend play a game: will write a number n pieces of paper and put it in the pocket, you can pump four pieces of paper from his pocket and write down the Numbers on the paper after every time it put back orifice bag, if the four Numbers and is m, is that you win, or your friends, your challenge several times, not once won a result, the anger and torn pockets, take out all the pieces of paper, check whether you really have the possibility of a win, would you please write a program to determine when the paper is written by the digital k1, k2,... Extraction, kn, whether there is 4 times and plan for m, if present, output Yes; Otherwise No output,
Enter
The first behavior integer n (1 & lt;=nO
If there is a draw for four and scheme for m, output Yes; Otherwise No output,
The sample input
3
10
1 3 5
Sample output
Yes

Tip:

Four sample extraction result is 1,1,3,5, and is 10,

//it is better to binary search

CodePudding user response:

Big help!!!
  • Related