OJ Question Record: Question A: Microbial reproduction

Problem A: Microbial reproduction

Title description:
Assume that there are two microorganisms X and Y
X divide every 3 minutes after birth (double the number), and Y divide every 2 minutes after birth (double the number).
A new born X will eat 1 Y after half a minute, and from then on, eat 1 Y every 1 minute.
What if X=10 and Y=90?
The requirement of this question is to write the number of Y after 60 minutes under these two initial conditions.
Input
No
Output
Because the question is a fill-in-the-blank question, just print the result

Problem-solving ideas:
Use the program to simulate the above process.

Customs clearance code:

#include <iostream>

using namespace std;

int main() {
    
    	
	int X = 10, Y = 90;
	
	for (int t = 1; t < 61; t++) {
    
    
		Y -= X;
		if (t % 2 == 0)	Y *= 2;
		if (t % 3 == 0) X *= 2;
	}
	
	cout << Y;
	
	return 0;
}

complete.

Guess you like

Origin blog.csdn.net/weixin_45711556/article/details/108998169