当前位置:网站首页>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;
}
边栏推荐
- Mongodb index
- String substitution
- 556. The next larger element III
- 7-1 positive integer a+b (15 points)
- China PETG market forecast and Strategic Research Report (2022 Edition)
- Sword finger offer 28 Symmetric binary tree
- 使用并行可微模拟加速策略学习
- Polestar美股上市:5.5万台交付如何支持得起超200亿美元估值
- JVM garbage collector
- Sub GHz wireless solution Z-Wave 800 Series zg23 SOC and zgm230s modules
猜你喜欢
Puzzle (016.4) domino effect
泰凌冲刺科创板:拟募资13亿 国家大基金与小米长江是股东
Showmebug entered Tencent conference, opening the era of professional technical interview
Luogu p4047 [jsoi2010] tribal division solution
Mysql多表查询 #子查询
Frequently asked questions: PHP LDAP_ add(): Add: Undefined attribute type in
Four data flows and cases of grpc
Protobuf and grpc
Puzzle (016.3) is inextricably linked
Pyqt interface production (login + jump page)
随机推荐
剑指 Offer 28. 对称的二叉树
Showmebug entered Tencent conference, opening the era of professional technical interview
Puzzle (016.4) domino effect
洛谷P5536 【XR-3】核心城市 题解
Luogu p5194 [usaco05dec]scales s solution
Luogu p4047 [jsoi2010] tribal division solution
Sub GHz wireless solution Z-Wave 800 Series zg23 SOC and zgm230s modules
7-22 tortoise and rabbit race (result oriented)
洛谷P3065 [USACO12DEC]First! G 题解
Niuke: crossing the river
MySQL multi table query subquery
SSH访问控制,多次失败登录即封掉IP,防止暴力破解
7-15 calculation of PI
Paper sharing: generating playful palettes from images
Luogu p3065 [usaco12dec]first! G problem solution
7-23 currency conversion (using array conversion)
Plane vector addition
表单文本框的使用(一) 选择文本
洛谷P5194 [USACO05DEC]Scales S 题解
npm install卡住与node-npy的各种奇怪报错