当前位置:网站首页>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;
}
边栏推荐
- DHCP原理与配置
- raid磁盘阵列
- iptables防火墙
- Hdu-5805-nanoape loves sequence (thinking questions)
- 防火墙——iptables防火墙(四表五链、防火墙配置方法、匹配规则详解)
- Gerapy use
- Archery database audit platform deployment
- What is the most practical gift for Tanabata? A gift that will never go wrong is worth buying
- MOOC翁恺C语言第五周:1.循环控制2.多重循环3.循环应用
- Technology sharing | detailed explanation of actual combat interface test request methods get, post
猜你喜欢

Custom component -- communication between parent and child components

DNS domain name resolution service

Which brand of air conduction earphones is better? These four should not be missed

技术分享 | 接口测试价值与体系

Technology sharing | how to simulate real use scenarios? Mock technology to help you

iptables防火墙

Firewall - iptables firewall (four tables and five links, firewall configuration method, detailed explanation of matching rules)

Custom component -- data listener

Shell script - "three swordsmen" awk command

File operation in C language
随机推荐
HDU-5783 Divide the Sequence(贪心水题)
Difference between process and thread
How to describe a bug and the definition and life cycle of bug level
It is recommended to wear air conduction earphones, which do not need to wear in ear
Ubuntu MySQL setting remote access permissions
测试人生 | 二线城市年薪超40W?疫情之下涨薪100% + 是怎么做到的?
QGraphicsView提升为QChartView
MySQL master master
Network - data link layer
shell脚本——sort、uniq、tr、数组排序、cut、eval命令配置
[learning notes] process creation
Hdu-5805-nanoape loves sequence (thinking questions)
Create, traverse and search nodes as required for single linked list
Which brand of air conduction earphones is good and highly praised
Hdu-5783 divide the sequence (greedy water question)
Esxi community network card driver updated in March 2022
[learning notes] linked list operation
Which is the best and most cost-effective air conduction headset recommended
MOOC翁恺C语言第八周:指针与字符串:1.指针2.字符类型3.字符串4.字符串计算
What is the most practical gift for Tanabata? A gift that will never go wrong is worth buying