生日蜡烛
某君从某年开始每年都举办一次生日party,并且每次都要吹熄与年龄相同根数的蜡烛。
现在算起来,他一共吹熄了236根蜡烛。
请问,他从多少岁开始过生日party的?
请填写他开始过生日party的年龄数。
#include<bits/stdc++.h>
using namespace std;
//const int MAX=1000000;
typedef long long int ll;
const int MAX=20222022;
int dp[2];
int max_len=1189;
int min_len=841;
inline ll ksc(ll a,ll b,ll mod)
{
a%=mod;
b%=mod;
return (a*b-(ll)((long double)a/mod*b)*mod+mod)%mod;
}
inline ll ksm(ll a,ll b,ll c)
{
ll res=1;
while(b)
{
if(b&1)
res=ksc(res,a,c);
a=ksc(a,a,c);
b>>=1;
}
return res;
}
int target=236;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
for (int i=1;i<=100;i++)
{
//开始年龄
sum=0;
for(int j=i;j<=100;j++)
{
sum+=j;
if (sum>target)
break;
}
if (sum==target)
{
cout<<i<<"\n";
break;
}
}
return 0;
}
啊啊啊啊,我在些什么!!!