Home > Back-end >  Pick apples upgrade code correct.
Pick apples upgrade code correct.

Time:10-27

#include
Int main ()
{
Int n, s, a, b;
The scanf (" % d % d ", & amp; N, & amp; s);
The scanf (" \ n % d % d ", & amp; A, & amp; B);
Int x [n], [n] y, num=0;
for(int i=0; iThe scanf (" \ n % d % d ", & amp; [I], x & amp; Y [I]);
for(int i=0; iIf (x [I] <=a + b& & S - [I] y & gt;=0)
S=s - [I], y + + num.
Printf (" % d ", num);
return 0;

}

CodePudding user response:

Is it the problem you want to be a simple, or I think complex problems?
Strength - 3, for example, the following apple needs to strength (level does not consider first)
Apple 1 to 3
Apple's strength 2
Apple is 3 to 1
Apple 4 to 1
Apple 5 strength 1
According to your logic, most can only pick one apple (apple), energy is used up, but I think I should pick three apple apple (apple 3, 4, 5) is the maximum number of an apple,

CodePudding user response:

The original problem is some ceramic picking apples, baidu has

CodePudding user response:

reference 1st floor qybao response:
is the problem you want to be a simple, or am I think complex problems?
Strength - 3, for example, the following apple needs to strength (level does not consider first)
Apple 1 to 3
Apple's strength 2
Apple is 3 to 1
Apple 4 to 1
Apple 5 strength 1
According to your logic, most can only pick one apple (apple), energy is used up, but I think I should pick three apple (apple 3, 4, 5) apple is an apple, the maximum number of

Code is right, I changed several groups of data on the compiler is right

CodePudding user response:

refer to the second floor beginners side response:
the original topic is some ceramic pick apples, baidu has

Well, but I think that kind of code is too complex

CodePudding user response:

You with I say the data is right? You assume height are the same, then an example in my effort to input data, and see the results right?

CodePudding user response:

reference 4 floor qq_46374834 response:
Quote: refer to the second floor novice dishes response:
the original topic is some ceramic pick apples, baidu has

Well, but I think that the code is too complex
this is a struct... Can have simple code
  • Related