当前位置:网站首页>结果填空 生日蜡烛
结果填空 生日蜡烛
2022-07-28 05:19:00 【小白鼠零号】
某君从某年开始每年都举办一次生日party,并且每次都要吹熄与年龄相同根数的蜡烛。
现在算起来,他一共吹熄了236根蜡烛。
请问,他从多少岁开始过生日party的?
请填写他开始过生日party的年龄数。
答案
26
解题过程
很常规的用等差数列公式+for循环能解决的题目。
附上代码
#include<iostream>
using namespace std;
int main()
{
void find();
find();
return 0;
}
void find()
{
int sum=0;
for(int i=1;i<=100;i++)
{
for(int j=100;j>i;j--)
{
sum=(i+j)*(j-i+1)/2;
if(sum<236)
break;
if(sum==236)
{
cout<<i<<endl;
return;
}
}
}
}
边栏推荐
- The way of deep learning thermodynamic diagram visualization
- 截图传入后台
- 树莓派蓝牙调试过程
- Idea uses dev tool to realize hot deployment
- RESNET structure comparison
- c语言:通过一个例子来认识函数栈帧的创建和销毁讲解
- 标准C语言学习总结8
- Review of metallurgical physical chemistry -- Fundamentals of metallurgical reaction kinetics and characteristics of multiphase reaction kinetics
- 对极大似然估计、梯度下降、线性回归、逻辑回归的理解
- Centos7 install MySQL 5.7
猜你喜欢

NRF51822 回顾总结

DOM基础

c语言:通过一个例子来认识函数栈帧的创建和销毁讲解

Review of metallurgical physical chemistry -- Fundamentals of metallurgical reaction kinetics and characteristics of multiphase reaction kinetics

ArcGIS地图制作的注记、格网添加

DOM操作的案例

A file upload tool website written by individuals
![[idea plug-in artifact] teaches you how to set all attributes in an entity class with one click of idea](/img/d6/4e69480c5ad5040ee48941ca0fcb37.png)
[idea plug-in artifact] teaches you how to set all attributes in an entity class with one click of idea

冶金物理化学复习 --- 金属的电沉积,还原过程

Centos7 install MySQL 5.7
随机推荐
Database interview
openjudge:过滤多余的空格
基于Highcharts平台的桑基图(Sankey diagram)绘制
Advanced multithreading: the role and implementation principle of volatile
冶金物理化学复习 --- 化学反应动力学基础
Writing methods of scientific research papers: add analysis and discussion in the method part to explain their contributions and differences
[MySQL] solve the problem of MySQL time zone and 8-hour difference in database time
Mutual conversion between latex and word
GIS领域竞赛整理(不完全统计)
标准C语言学习总结7
Review of metallurgical physical chemistry -- Fundamentals of chemical reaction kinetics
【博学谷学习记录】超强总结,用心分享 | 集合
Microsoft Edge浏览器插件(2)
Review of metallurgical physical chemistry ---- gas solid reaction kinetics
标准C语言学习总结3
标准C语言总结2
基于XMind的E-R图制作
Low illumination image data set
JS数组的方法大全
DOM窗口相关数据、操作 & BOM操作