[Questions of the Blue Bridge Cup] questions of Euler's, eggs, and Blue Bridge
The great mathematician Euler met two rural women in the village at the fair, each carrying an empty basket. They greeted Euler and said they had just sold all the eggs.
Euler casually asked: "How many eggs are sold ?"
Unexpectedly, they said, "The two of us sold our own eggs. They sold a total of 150 eggs. Although we sold a lot of eggs, we just got the same amount of money. You can guess !"
Euler cannot guess.
Another added: "If I sell at that price, I will get 32 yuan. If I sell at my price, I will get 24.5 yuan ".
Euler thought and gave the correct answer.
We are not mathematicians, so we are too reluctant to list formulas for analysis. However, a computer can "brute-force cracking", that is, to test all possible conditions, until it hits!
Write the number of eggs per person (unlimited order), separated by commas.
The answer is written in dig into. txt. Do not write it here!
Reference answer:
70, 80 or 80, 70
Experience: At first, I thought I could get 32 or 24.5 for selling them together.
Then calculate the numbers 0 and 150, and output some strange numbers. But finally, it's right.
1 # include <stdio. h> 2 int main (void) 3 {4 int I; 5 int j; 6 for (I = 1; I <150; I ++) 7 for (j = 1; j <150; j ++) 8 {9 if (I * (32.0/(150-i) = (j * (24.5/(150-j )))) printf ("% d, % d", I, j); 10} 11 return 0; 12}