当前位置:网站首页>Result number of filled briquettes
Result number of filled briquettes
2022-07-28 07:01:00 【White mouse zero】
There's a bunch of coal balls , Pile up in a triangular pyramid . Specifically :
On the first floor 1 individual ,
The second floor 3 individual ( In a triangle ),
The third level 6 individual ( In a triangle ),
The fourth level 10 individual ( In a triangle ),
....
If there is 100 layer , How many coal balls are there ?
Please fill in the number of coal balls .
answer
171700
The problem solving process
The clear topic is 1~100 The sum of coal briquettes , Then this topic must have rules . Here, the law of the number of briquettes in each layer is analyzed :
first floor :1
The second floor :1+2
The third level :1+2+3
The fourth level :1+2+3+4
……
The hundredth floor :1+2+……+100
Obviously, the number of each layer is an arithmetic sequence , The arithmetic sequence formula :Sn=(a1+an)*n/2
Attach code
#include<iostream>
using namespace std;
int main()
{
int sum=0;
int n;
cin>>n;
for(int i=1;i<=n;i++)
sum+=(1+i)*i/2;
cout<<sum<<endl;
return 0;
}
边栏推荐
- KVM热迁移
- Repair the faulty sector
- Custom component -- pure data field & component life cycle
- Wechat applet custom compilation mode
- Esxi community network card driver updated again
- Compilation and preprocessing of C language
- 搭建PHP7私有仓库
- RAID disk array
- 2022 Tanabata gift recommendation! Nice, cheap and practical gift recommendation
- Shell script -- program conditional statements (conditional tests, if statements, case branch statements, echo usage, for loops, while loops)
猜你喜欢

What kind of air conduction Bluetooth headset with good configuration is recommended

NAT和PAT的原理及配置

MySQL master master

shell脚本——sort、uniq、tr、数组排序、cut、eval命令配置

What is the good brand of air conduction Bluetooth headset and the best brand recommendation of air conduction headset

搭建PHP7私有仓库

Applet navigator cannot jump (debug)

MySQL master-slave

What's a good gift for Tanabata? Niche and advanced product gift recommendation

FTP服务
随机推荐
Which is the best one to make air conduction headphones? Inventory of the best air conduction headphones
Shell script - "three swordsmen" awk command
cocos2d-x 学习笔记——瓦片地图TiledMap
DNS domain name resolution service
DHCP原理与配置
Shell script - sort, uniq, TR, array sort, cut, Eval command configuration
MOOC翁恺C语言第五周:1.循环控制2.多重循环3.循环应用
HDU-2036-改革春风吹满地(多边形面积模板)
What's a good gift for Tanabata? Niche and advanced product gift recommendation
1、 PXE overview and installation
CentOS7部署MySQL数据库服务器
2022 Tanabata gift recommendation! Nice, cheap and practical gift recommendation
Applets: lifecycle
Compilation and preprocessing of C language
Test interview questions collection (II) | test tools (with answers)
Shell script -- program conditional statements (conditional tests, if statements, case branch statements, echo usage, for loops, while loops)
Clock tree analysis example
Vmware workstation configuration net mode
C language memcpy library functions and the role of memmove
Ubuntu18.04 set up redis cluster [learning notes]