当前位置:网站首页>Zzuli:1054 monkeys eat peaches
Zzuli:1054 monkeys eat peaches
2022-07-03 14:34:00 【Snake_____】
Title Description
Wukong picked some peaches on the first day , Eat half immediately , Not yet , Eat another one , The next day, he ate half of the remaining peaches and more than one , After that, eat more than half of the rest of the previous day every day , To the first n One day when I was ready to eat, there was only one peach left . Smart you , Please help Wukong calculate , How many peaches did he have when he started eating on the first day ?
Input
Enter a number n(1<=n<=30).
Output
Output the number of peaches in the first day .
The sample input Copy
3
Sample output Copy
10
#include <stdio.h>
int main()
{
int n,i,sum=1;
scanf("%d",&n);
for(i=1;i<n;i++)
{
sum=2*(sum+1);
}
printf("%d",sum);
return 0;
}边栏推荐
- 别再问自己适不适合做软件测试了
- SSH访问控制,多次失败登录即封掉IP,防止暴力破解
- 洛谷P5194 [USACO05DEC]Scales S 题解
- Paper sharing: generating playful palettes from images
- 洛谷P5018 [NOIP2018 普及组] 对称二叉树 题解
- Sword finger offer 28 Symmetric binary tree
- String reverse order
- 添加Zabbix计算类型项目Calculated items
- 7-20 print 99 formula table (format output)
- Programming language: the essence of type system
猜你喜欢

Polestar美股上市:5.5万台交付如何支持得起超200亿美元估值

剑指 Offer 28. 对称的二叉树

使用并行可微模拟加速策略学习

Concat and concat_ Ws() differences and groups_ Use of concat() and repeat() functions

Mysql多表查询 #子查询

X86 assembly language - Notes from real mode to protected mode
![洛谷P5018 [NOIP2018 普及组] 对称二叉树 题解](/img/89/da1a3a38e02671628f385de0f30369.png)
洛谷P5018 [NOIP2018 普及组] 对称二叉树 题解

Happy capital new dual currency fund nearly 4billion yuan completed its first account closing

retrofit

tonybot 人形机器人 首次开机 0630
随机推荐
1017 a divided by B (20 points)
dllexport和dllimport
使用并行可微模拟加速策略学习
添加Zabbix计算类型项目Calculated items
Bibit pharmaceutical rushed to the scientific innovation board: annual revenue of 970000, loss of 137million, proposed to raise 2billion
Solr series of full-text search engines - basic principles of full-text search
论文分享:Generating Playful Palettes from Images
tonybot 人形机器人 查看端口并对应端口 0701
puzzle(016.3)千丝万缕
必贝特医药冲刺科创板:年营收97万亏损1.37亿 拟募资20亿
Thread.sleep和TimeUnit.SECONDS.sleep的区别
pyQt界面制作(登录+跳转页面)
【7.3】146. LRU缓存机制
puzzle(016.4)多米诺效应
7-16 find the set of integers that meet the given conditions
Sub GHz wireless solution Z-Wave 800 Series zg23 SOC and zgm230s modules
Four data flows and cases of grpc
Analysis of gene family characteristics - chromosome location analysis
DDK for XP
String sort