当前位置:网站首页>Daily practice of C language --- monkeys divide peaches
Daily practice of C language --- monkeys divide peaches
2022-07-02 13:30:00 【Edsu】
subject :
There is a pile of peaches on the beach , Five monkeys to share . The first monkey divided the pile of peaches into five parts , More One , The monkey threw one more into the sea , Took a share of . The second monkey divided the remaining peaches equally In five , One more , It also throws one more into the sea , Took a share of , Third 、 Fourth 、 Fifth Monkeys do this , Ask how many peaches there used to be on the beach ?
The code analysis :
#include <stdio.h>
#include<stdlib.h>
int main(){
int x=0,i=0,j=1;//i Indicates the number of times of execution
while(i<5){//j It means the number of peaches the monkey finally got
x=4*j;
for(i=0;i<5;i++){
if(x%4!=0)
break;
x=(x/4)*5+1;}
j++;}
printf("%d\n",x);// After averaging each time , Take the total after .
return 0;
} Code effect :

Monkeys at least used to have 3121 A peach !
边栏推荐
- D为何链接不了dll
- 无向图的桥
- Engineers who can't read device manuals are not good cooks
- 基于ssm+jsp框架实现的学生选课信息管理系统【源码+数据库】
- JS generates 4-digit verification code
- Jerry's weather direction coding table [chapter]
- EasyDSS点播服务分享时间出错如何修改?
- How to modify the error of easydss on demand service sharing time?
- OpenFOAM:lduMatrix&lduAddressing
- Redis database persistence
猜你喜欢

Unity skframework framework (XIII), question module

研究表明“气味相投”更易成为朋友
![Jerry's watch ringtone audition [article]](/img/18/905c4b64443f4efca55188e36f4b28.jpg)
Jerry's watch ringtone audition [article]

TVOC, VOC, VOCs gas detection + Solution

Gee learning notes 2

基于ssm+jsp框架实现的学生选课信息管理系统【源码+数据库】
![Jerry's watch modifies the alarm clock [chapter]](/img/d6/04fb8143027578bb707529a05db548.jpg)
Jerry's watch modifies the alarm clock [chapter]

Unity skframework framework (XV), singleton singleton

Redis数据库持久化

De4000h storage installation configuration
随机推荐
Fundamentals of face recognition (facenet)
三谈exception——错误处理
自主可控三维云CAD:CrownCAD赋能企业创新设计
【OpenGL】笔记二十九、高级光照(镜面高光)
Performance optimization of memory function
Uniapp develops wechat applet Tencent map function and generates sig signature of location cloud
TVOC, VOC, VOCs gas detection + Solution
linux下清理系统缓存并释放内存
OpenFOAM:lduMatrix&lduAddressing
Unity SKFramework框架(十五)、Singleton 单例
最近公共祖先LCA的三种求法
JS逆向之巨量创意signature签名
Fully autonomous and controllable 3D cloud CAD: crowncad's convenient command search can quickly locate the specific location of the required command.
Finally, someone explained the supervised learning clearly
基于ssm+jsp框架实现的学生选课信息管理系统【源码+数据库】
题解:《压缩技术》(原版、续集版)
Unity SKFramework框架(十六)、Package Manager 开发工具包管理器
SAP MM 因物料有负库存导致MMPV开账期失败问题之对策
Mysql常用命令详细大全
Jerry's watch stops ringing [article]