当前位置:网站首页>蓝桥杯 微生物增殖 C语言
蓝桥杯 微生物增殖 C语言
2022-07-06 11:38:00 【大菜彩】
微生物增殖
假设有两种微生物 X 和 Y
X出生后每隔3分钟分裂一次(数目加倍),Y出生后每隔2分钟分裂一次(数目加倍)。
一个新出生的X,半分钟之后吃掉1个Y,并且,从此开始,每隔1分钟吃1个Y。
现在已知有新出生的 X=10, Y=89,求60分钟后Y的数目。
如果X=10,Y=90呢?
本题的要求就是写出这两种初始条件下,60分钟后Y的数目。
以下程序实现了这一功能,请你补全空白处内容:
提示:Y分别会在0.5,1.5,2.5······时被吃,所以,把60分钟分成120份,则在除以2余数为1时,Y的数目减少X个
当X=10, Y=89,代码:
#include<stdio.h>
int main()
{
int x=10,y=89;
for(int t=1;t<=120;t++) //半分钟一个单位 60分钟为120个单位
{
if(t%2==1)
y=y-x; //因为X出生半分钟后就要吃Y,之后每1分钟要吃Y,所以永远都是奇数个半分钟的时候吃Y
if(t%4==0) //每两分钟翻倍
y=y*2;
if(t%6==0) //每三分钟翻倍
x=x*2;
}
printf("%d",y);
return 0;
} 运行结果为负数,故y=0。
当X=10, Y=90,运行结果:

边栏推荐
- 史上超级详细,想找工作的你还不看这份资料就晚了
- 深入分析,Android面试真题解析火爆全网
- Pytorch common loss function
- How to do smoke test
- Tensorflow and torch code verify whether CUDA is successfully installed
- How to customize animation avatars? These six free online cartoon avatar generators are exciting at a glance!
- usb host 驱动 - UVC 掉包
- MySQL information schema learning (I) -- general table
- [translation] supply chain security project in toto moved to CNCF incubator
- Is not a drawable (color or path): the vector graph downloaded externally cannot be called when it is put into mipmap, and the calling error program crashes
猜你喜欢

五金机电行业供应商智慧管理平台解决方案:优化供应链管理,带动企业业绩增长
![[translation] micro survey of cloud native observation ability. Prometheus leads the trend, but there are still obstacles to understanding the health of the system](/img/63/3addcecb69dcb769c4736653952f66.png)
[translation] micro survey of cloud native observation ability. Prometheus leads the trend, but there are still obstacles to understanding the health of the system

How to access localhost:8000 by mobile phone

冒烟测试怎么做

第五期个人能力认证考核通过名单公布

学习探索-使用伪元素清除浮动元素造成的高度坍塌

Take a look at how cabloyjs workflow engine implements activiti boundary events

接雨水问题解析

zabbix 代理服务器 与 zabbix-snmp 监控

Interface test tool - postman
随机推荐
如何自定义动漫头像?这6个免费精品在线卡通头像生成器,看一眼就怦然心动!
三面蚂蚁金服成功拿到offer,Android开发社招面试经验
Interview assault 63: how to remove duplication in MySQL?
Help improve the professional quality of safety talents | the first stage of personal ability certification and assessment has been successfully completed!
Systematic and detailed explanation of redis operation hash type data (with source code analysis and test results)
[pytorch] yolov5 train your own data set
Excel 中VBA脚本的简单应用
GCC【7】- 编译检查的是函数的声明,链接检查的是函数的定义bug
JDBC details
凤凰架构3——事务处理
主从搭建报错:The slave I/O thread stops because master and slave have equal MySQL serv
CCNP Part 11 BGP (III) (essence)
Low CPU load and high loadavg processing method
Detailed idea and code implementation of infix expression to suffix expression
In 50W, what have I done right?
LeetCode_格雷编码_中等_89.格雷编码
Actf 2022 came to a successful conclusion, and 0ops team won the second consecutive championship!!
Don't miss this underestimated movie because of controversy!
学习探索-无缝轮播图
Sanmian ant financial successfully got the offer, and has experience in Android development agency recruitment and interview